6-2 喜欢的数字
num={'Jack':'1','Dan':'2','Mike':'3','Joe':'4','Alice':'5'}
for name,value in num.items():
print(name.title()+"'s favorite number is "+num[name])
6-5 河流
river={'nile':'eygpt','amazon':'brazil','yellow river':'china'}
for name,value in river.items():
print("The "+name.title()+" runs through "+river[name].title())
for name in river.keys():
print(name.title())
for name in river.values():
print(name.title())
6-9 喜欢的地方
favorite_places={'Mike':['Paris'],'Joe':['London','New York'],'Dan':['Beijing']}
for name,places in favorite_places.items():
print(name.title()+"'s favorite place is ")
for place in places:
print('\t' + place.title())
6-10 喜欢的数字
num={'Jack':['1','7'],'Dan':['2','8','0'],'Mike':['3','2','11'],'Joe':['4','9'],'Alice':['5','10']}
for name,values in num.items():
print(name.title()+"'s favorite number is ")
for value in values:
print('\t'+value)