people = { "first_name" : 'zetrue' , "last_name": 'Lee' , "age": 20 , "city" : "汕尾" }
print( people)
for key in people.keys() :
print( key , " : " , people[key] )
favorite_val = {'a':1 , 'b':2, 'c':3 , 'd':4 }
for people in favorite_val.keys() :
print( people , " : " , favorite_val[people] )
rivers = { 'nile':'Egypt' , 'Mississippi' : 'America' , 'Amazon': 'Spain' }
for river in rivers.keys() :
print( "The " + river.title() + " runs through " + rivers[river] )
for river in rivers.keys() :
print( river )
for ele in rivers.values() :
print( ele )
people = [ 'a','b','c','d','e']
favorite_languages = { 'a': 'Chinese' , 'e':'English'}
for ele in people :
if ( ele in favorite_languages ) :
print( "Thank you ," , ele )
else :
print( ele , ", Please tell me your favorite language " )
people1 = { "first_name" : 'zetrue' , "last_name": 'Lee' , "age": 20 , "city" : "汕尾" }
people2 = { "first_name" : 'yifei' , "last_name": 'Lee' , "age": 20 , "city" : "绥化" }
people3 = { "first_name" : 'yang' , "last_name": 'Lin' , "age": 20 , "city" : "汕头" }
people = [ people1 , people2 , people3 ]
for ele in people :
print ( ele )
alice = { 'type': 'cat' , 'master':'zetrue' }
bob = { 'type' : 'dog' , 'master': 'yifei' }
mars = {'type' : 'lion' , 'master': 'bruno' }
pets = [ alice , bob , mars ]
for ele in pets :
for key in ele.keys():
print( key , ' ' , ele[key] , end = ' ' )
print()
favorite_places = { 'a':'France' , 'b': 'Polish' , 'c': 'England'}
for ele in favorite_places.keys():
print( ele , " : " , favorite_places[ele] )
Yue = { 'country' : 'guangzhou' , 'population': 1270 , 'fact' : 'food' }
Hu = { 'country' : 'shanghai' , 'population': 2302 , 'fact' : 'beauty' }
Jing = { 'country' : 'beijing' , 'population': 1961 , 'fact' : 'culture' }
cities = { 'guangzhou' : Yue , 'shanghai': Hu , 'beijing' : Jing }
for city in cities.values() :
print( city )