# min and max function are available for a list
numbers = [20, 32, 21, 26, 33, 22, 18]
print( min(numbers) )
print( max(numbers) )

# measuring central tendancies -
# mean (mean old avg), median (middle), mode (m.ost o.ften)

# dictionaries - nonsequential collections of (key, value) pairs.
# keys -- the items BEFORE the colon; usually a string
# values -- the items AFTER the colon; can be a string/number/boolean/dictionary/list/etc.
ages = {'David': 45, 'Brenda': 46, 'Hannah': 16, 'Kelsey':30}

# access an element based on its key (like an index, but not a number)
# read as "the value associated with the key 'David'"
print(ages['David'])

print(ages)
ages['Brenda'] = 50   # changes the value of the element associated with the key 'Brenda'
print(ages['Brenda'])
print(ages)


# Add a new item to the dictionary: the element with key 'Drew' and value 20
# Note: if this was already in the dictionary,
#    then we would update the value associated with the key.
ages['Drew'] = 20
print(ages)


# ------ some dictionary functions ------ 

# get a list of all keys 
print(ages.keys())
for item in ages.keys():
    print(item)

# get a list of all values
print(ages.values())
for item in ages.values():
    print(item)

# get a list of all (key, value) pairs
print(ages.items())
for item in ages.items():
    print(item)