Mapa mental
DATA STRUCTURES
Contenido del mapa
DATA STRUCTURES
LISTS
- [...,...,...,...]
- Changeable, ordered, allow duplicates
- CAN include elements w different data types
- Adding a element to a list → place it at the end EX:myList.append
- When deleting an element from a list → remove or pop EX: myList.remove(“”) OR myList.pop(“”)
- Access an element in a list, use the square brackets (w placement in list (starts w 0)) Item = myList[2]
TUPLES
- (...,...,...,)
- Used to store multiple items in a single variable
- Ordered, unchangeable, and allow duplicates
SETS
- Unordered, unchangeable, reject duplicates
- Elements w different data types
- mySet - {..,...,...}
- Don't use indices to access sets BUT can Loop to see their items EX: for x in mySet: print (x)
- Can also check (TRUE or FALSE) in an element exists in Set EX: print(“banana” in mySet)
- Can add elements to set using .add(...)
- Merge sets using .update(...)
DICTIONARIES
- Store data in key:value format
- Very powerful structures to describe items
- Values in dictionary can be of any datatype EX: carOnSale = { “Brand”: “Toyota”, “Year”: 2018, }
- When printed: {key1:value1, …, …}
Información
- Descripción
- Mapa Mental sobre DATA STRUCTURES, creado por Danielle Dietz el 12/09/2021.
- Creado por
- Danielle Dietz
- Visitas
- 0
- Valoración