Mind map
Second Assignment
Map content
Second Assignment
Lists [...,...,...]
- Lists are ordered, so you can play with the indices and access list items with square brackets ex. myList[2]
- changeable
- allow duplicates
- They can have elements with different data types
- When you add data to a list its always placed at the end
- to delete an element we can remove or pop ex. myList.remove("Lemon")
Tuples (...,...,...)
- used to store multiple items in a single variable
- ordered
- we can play with the indices and call on items ex. myTuple[2]
- myTuple[-1] call on the last item
- myTuple[1:3] will return a subtuple of the 2nd, 3rd and 4th elements
- myTuple[-1] call on the last item
- we can play with the indices and call on items ex. myTuple[2]
- unchangeable
- allow duplicates
- allow multiple data types
Sets {...,...,...}
- unordered
- so for loops are helpful to see items
- or try true or false to see if an element exists in the set
- so for loops are helpful to see items
- unchangeable
- reject duplicates
- allow multiple data types
- add elements by using .add ex. mySet.add("orange")
- we can also merge sets by using .update ex. if newSet is an additional set, mySet.update(newSet)
- unordered
Dictionaries {key1:value1,...keyn:valuen}
- used to store data in key:value format
- VERY powerful to describe items
- to me dictionaries seem the most useful data structure as far as "real world application goes"
- the most different out of these four data structures
- values in a dictionary can be of any data type
Information
- Description
- Mind Map on Second Assignment, created by Colleen Faherty on 03/02/2021.
- Created by
- Colleen Faherty
- Views
- 0
- Rating