lekcia 4 Flashcards
ake pozname datpve typy
list, tuple, set, dictionary
list
ordered collection= [1, 2, 3] zmiesane data
tuple
non-modification ordered collection (1, 2, 3)
set
unorganized collection of unique values {1, 2, 3} nahadzane v taske kazde raz
dictionary
unordered (key,value) mapping {‘a’:1, ‘b’:2, ‘c’:3}
indexovanie
grocery_list[:3] vyberie hodnoty 0 1 2
zaporne indexovanie
grocery_list[:-3] grocery_list[-3:]
zamen element v list
grocery_list[2] = “Green Juice”
dodaj, vloz element v list
grocery_list.append(‘Apples’)
vloz element v list
grocery_list.insert(3, ‘Oranges’)
vymaz element v list
grocery_list.remove(‘Oranges’)
zorad list
grocery_list.sort()
spoj listy
list_both = list_first + list_second
vynasob listy
multiplied_list = numbers_list * 3
vytvor tuple s list
grocery_tuple = tuple(grocery_list)