0% found this document useful (0 votes)
4 views1 page

Python Built-in Data Structures

The document provides an overview of built-in data structures in Python, including lists, tuples, dictionaries, and sets. It includes code examples demonstrating how to create and access elements in each data structure. Each example highlights the unique characteristics of the respective data structure.

Uploaded by

Carl Max
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Python Built-in Data Structures

The document provides an overview of built-in data structures in Python, including lists, tuples, dictionaries, and sets. It includes code examples demonstrating how to create and access elements in each data structure. Each example highlights the unique characteristics of the respective data structure.

Uploaded by

Carl Max
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Data Structures in Python

Python provides built-in data structures like lists, tuples, dictionaries, and sets.

Lists:

```python

fruits = ["apple", "banana", "cherry"]

print(fruits[1]) # Output: banana

```

Tuples:

```python

colors = ("red", "green", "blue")

print(colors[0]) # Output: red

```

Dictionaries:

```python

person = {"name": "John", "age": 25}

print(person["name"]) # Output: John

```

Sets:

```python

unique_numbers = {1, 2, 3, 3, 2}

print(unique_numbers) # Output: {1, 2, 3}

```

You might also like