Mind map
Basic Python Data Structures
Map content
Basic Python Data Structures
List
- One of 4 built-in date sturcture
- Changable
- We can change the variable in side a List after the List has been defined
- Ordered
- Variable in List is well-ordered, which means, we can retrieve the variable by the order
- a_list = ["a", "a", "b", "c" ] print(a_list[0]) will print "a"
- Allow Duplicate element
- We can add duplicate element in List
- fruit = ["apple", "banana", "cherry", "apple", "cherry"]
- Changable
- a_list = ["a", "a", "b", "c" ]
- Other function
- len() will return the length of a list
- thislist = ["a", "b", "c"] print(len(thislist)) will print 3
- len() will return the length of a list
- Data Type
- string
- int
- boolean
- One of 4 built-in date sturcture
Tuples
- a_tuple = ("a", "b", "c")
- Data Type
- string
- int
- boolean
- Other function
- len() will return the length of a list
- thistuple = ("a", "b", "c") print(len(thislist)) will print 3
- len() will return the length of a list
- One of 4 built-in date sturcture
- Unchangable
- We cannot change the variable in side a Tuple after the List has been defined
- Ordered
- Variable in List is well-ordered, which means, we can retrieve the variable by the order
- a_tuple = ("a", "a", "b", "c" ) print(a_tuple[0]) will print "a"
- Allow Duplicate element
- We can define duplicate element in Tuple
- fruit = ("apple", "banana", "cherry", "apple", "cherry")
- Unchangable
Sets
- a_set = {"a", "b", "c"}
- One of 4 built-in date sturcture
- Unordered
- Unordered means that the items in a set do not have a defined order.
- Python will print the element in a set in random order
- Unordered means that the items in a set do not have a defined order.
- Unchangable
- We cannot change the element after a set is defined
- But we can add new element
- Not allow duplicate element
- We cannot add duplicate element in Set
- fruit = {"apple", "banana", "cherry", "apple", "cherry"} print(fruit)
- {apple, banana, cherry}
- Unordered
- Other function
- len() will return the length of a list
- thisset = {"a", "b", "c"} print(len(thislist)) will print 3
- len() will return the length of a list
- Data Type
- int
- boolean
- string
Dictionaries
- a_dict = {'name': 'Alexander', 'age': 35, 'sex': 'male', 'income': 1500}
- Data Type
- int
- boolean
- string
- Other function
- len() will print out the length of a dictonary
- One of 4 built-in date sturcture
- Changable
- We can add, delete, or modify the element in dictonary
- Orded*
- Dictonary is an ordered Data Type and the order will not be changed
- Unordered before Python 3.6
- NOT allow the duplicate elements
- Dictonary and not have two item with the same key
- Changable
- dict = {'a_key': 'some_variable'}
Information
- Description
- Mind Map on Basic Python Data Structures, created by Takarada RikkAA on 13/09/2021.
- Created by
- Takarada RikkAA
- Views
- 0
- Rating