《Python编程——从入门到实践》第六章部分习题解
2018-03-21 22:06
591 查看
# 6-3 words = {'int' : 'integer', 'char' : 'character', 'long' : 'long integer', 'float' : 'single-precision floating-point', 'double' : 'double-precision floating-point'} for noun, means in words.items(): print(noun + ' : ' + means)
# 6-5 rivers = {'Danube' : 'Germany', 'Danube' : 'Austria', 'Nile' : 'Egypt', 'Yellow River' : 'China'} for river,country in rivers.items(): print('The ' + river + ' runs through ' + country) for key in set(rivers.keys()): print(key) for value in set(rivers.values()): print(value)
# 6-11 cities = {'New York' : {'country' : 'America', 'population' : '8.51m', 'fact' : 'There is a Wall Street.'}, 'London' : {'country' : 'England', 'population' : '8.28m', 'fact' : 'There is a Big Ben.'}, 'Hong Kong' : {'country' : 'China', 'population' : '7.41m', 'fact' : 'There is a Disneyland.'}} for city,city_info in cities.items(): print('City:' + city) print('\tCountry:' + city_info['country']) print('\tPopulation:' + city_info['population']) print('\tFact:' + city_info['fact'])
相关文章推荐
- 《Python编程——从入门到实践》第三章部分习题解
- Python编程从入门到实践 第二章部分习题练习
- python编程从入门到实践第六章习题
- Python编程:从入门到实践 第六章习题
- 《Python编程——从入门到实践》第七章部分习题解
- 《Python编程——从入门到实践》第十章部分习题解
- Python编程 从入门到实践 部分习题解答 第二章
- 《Python编程——从入门到实践》第十一章部分习题解
- 《python编程——从入门到实践》第二章部分习题练习
- 《Python编程——从入门到实践》第四章部分习题解
- 《Python编程 从入门到实践》第六章课后习题
- 《Python编程 从入门到实践》第六章习题选做
- 《Python编程——从入门到实践》第五章部分习题解
- 《Python编程——从入门到实践》第九章部分习题解
- 《Python编程 从入门到实践》第五章习题选做
- python编程:从入门到实践 第六章课后题
- 【《Python编程: 从入门到实践》习题答案--第九章:<类>】
- 《Python编程-从入门到实践》课后习题(7)
- 《Python编程-从入门到实践》第七章及第八章习题训练
- 《Python编程-从入门到实践》课后习题(9)