134k views
0 votes
Name Every Python Super Basic Datastructure?

1) List
2) Tuple
3) Set
4) Dictionary

User Thusithz
by
7.8k points

1 Answer

5 votes

Final answer:

The super basic data structures in Python are lists, tuples, sets, and dictionaries.

Step-by-step explanation:

List: A list in Python is an ordered collection of items that can be of different types. For example, [1, 'apple', True] is a list that contains an integer, a string, and a boolean value.

Tuple: A tuple is similar to a list but is immutable, meaning its elements cannot be modified after creation. Tuples are defined using parentheses. For example, (1, 'apple', True) is a tuple.

Set: A set is an unordered collection of unique elements. Duplicate values are automatically removed. For example, {1, 2, 3} is a set.

Dictionary: A dictionary is a collection of key-value pairs. Each key is unique and is used to access its corresponding value. Dictionaries are defined using curly braces and colons. For example, {'name': 'John', 'age': 20} is a dictionary.

User Henrique Rotava
by
8.5k points