Python Special Data Types

Tuples

Kinda like a list

Syntax:
variable_name = (‘a’, ‘b’, ‘c’,)

They cannot be changed

They can be indexed
So variable_name[0] will give you ‘a’

You can used the function tuple(x), to make x a tuple
Ex.
t = tuple(‘lupins’)
t
(‘l’, ‘u’, ‘p’, ‘i’, ‘n’, ‘s’)

Max() and min() also work in tuples

Dictionaries

A little collection of variables basically

KeysValues
Y26
Z84

Syntax:
x = {} or x = dict()
x = {key : value, key2 : value2}
Ex.
x = {‘lisa’:’12 y/o’, ‘elli’:’13 y/o’}

They are not organized so there are no number indexes, it is NOT an ordered data-type
You have to index it by the key and not a number
Ex.
x[key], and then you will print out the corresponding value and vice versa

.items(): can be used to print out the items in the dictionary

.keys(): can be used to print out the keys in the dictionary

.values(): can be used to print out the keys in the dictionary