Previous Lecture Complete and continue  

  Lesson 13: English Dictionary? NO. Python Dictionary.

11 comments
Aly Abo Ouf
https://repl.it/Ewl2/0
Ali
nice work
Ali
https://repl.it/FBVb/2
Zsolt Bisztray
https://repl.it/FBVb/2
Ereatara Kokiri
man that was hard
# dictionaries
# DICT[key] --> value
# LIST[0] --> first element of the list
# { key1: value1, key2: value2,...}

phone_book = {
'qazi': ['123-456-7890',[email protected]'],
'bob': ['222-222-2222', [email protected]'],
'cat': ['333-333-3333', [email protected]']
}

print(phone_book['qazi'][0])
print(phone_book['bob'][0])
print(phone_book['cat'][0])

# DICT[qazi] --> list of things containing ph# and email.
Sebastian Gomez
phone_book = {
"rodrigo":["12223","hotmail","H.St"],
"Rebeca":["12353","gmail","7.St"],
"Fatima":["43129","yahoo","Frez. St"]
}
Rebeca= phone_book["Rebeca"]
Rodrigo= phone_book["rodrigo"]
Fatima= phone_book["Fatima"]

print (Rebeca[0])
print(Rodrigo[1])
print(Fatima[2])
Danny B
phone_book={ 'bob':['9827375283964', '21 guava st', [email protected]', 'USA'],
"pete":['2352345726348', '345,hoer',[email protected]', 'Canada'],
'mike':['56723647286348', '45 dover',[email protected]', 'mexico']
}
>>> print(phone_book['mike'])
['56723647286348', '45 dover', [email protected]', 'mexico']

premier_league_table_points={ 'Manchester United': '33','Chelsea': '46', 'Liverpool':'40', 'Man.City':'39', 'Arsenal':'37'


}
>>> print(premier_league_table_points['Man.City'])
39
Hatim Elsadig Elamin Elhag
phonebook={
'police':['911',[email protected]'],
'airport':['100',[email protected]'],
'ambulance':['999',[email protected]']
}
print(phonebook['police'][0])
print(phonebook['police'][1])
print(phonebook['airport'][0])
print(phonebook['airport'][1])
print(phonebook['ambulance'][0])
print(phonebook['ambulance'][1])
Raitis Osis
Premier_league={
'Arsenal':['Sanchez',[email protected]', '1st'],
'Chelsea':['Oscar', [email protected]', '2nd'],
'ManU': ['Rooney', [email protected]', '3rd']
}

print(Premier_league['Arsenal'][1])
print(Premier_league['Arsenal'][0])
print(Premier_league['ManU'][2])
print(Premier_league['Chelsea'][2])
Marko Milovanovic
imenik={
"marko":["09888788", "[email protected]", "vuka karadzica"],
"slavica":["87878", "[email protected]", "rade sisk"],
"fixni":["7655556", "[email protected]", "gutiona durta"]}
marko, slavica, fixni=imenik
print(imenik[fixni][0])
print(imenik[slavica][2])
print(imenik[marko][1])
Dan Long
phonebook = ['07968530822', '999']
phonebook[0]
phonebook[1]
phonebook = {
'dan': ['07968530822',[email protected]'],
'police' : ['999', [email protected]']
}

print(phonebook['dan'][0])

print(phonebook['dan'][1])
print(phonebook['police'])
print(phonebook['police'][1])