6.7
friend_0 = {'first_name':'hao','last_name':'zeng yao','age':22,'city':'He zhe'}
friend_1 = {'first_name':'zhang','last_name':'yu','age':22,'city':'Ji nan'}
friend_2 = {'first_name':'yuan','last_name':'hao','age':21,'city':'Ji nan'}
friends = [friend_0,friend_1,friend_2]
for friend in friends:
print(friend)
6.8
pet_0 = {'type': 'dog','The host name': 'Tom'}
pet_1 = {'type': 'cat','The host name': 'john'}
pet_2 = {'type': 'pig','The host name': 'A'}
pets = [pet_0, pet_1, pet_2]
for pet in pets:
print(pet)
6.9
favorite_places = {
'alice': ['Hang zhou','Bei jing','Qing dao'],
'david': ['Macau'],
'carolina': ['Tai wan','Hong kong'],
}
for name,places in favorite_places.items():
print(f"\n{name.title()}'s favorite places are:")
for place in places:
print(f"\t{place.title()}")
6.10
favorite_numbers = {
python编程从入门到实践(第二版)第六章习题答案6.7-6.11
最新推荐文章于 2024-05-24 22:49:55 发布

最低0.47元/天 解锁文章
2938

被折叠的 条评论
为什么被折叠?



