高级编程技术第六次作业

6-5 河流

rivers = {
	'Yangtze River': 'China',
	'Nile': 'Egypt',
	'Amazonian River': 'Brazil',
	}
for r, c in rivers.items():
	print('The ' + r + ' runs through ' + c + '.')
for r in rivers.keys():
	print(r)
for c in rivers.values():
	print(c)

6-8 宠物

Dabao = {'name': 'Dabao', 'type': 'pekingese', 'master': 'Tom'}
Xiaobao = {'name': 'Xiaobao', 'type': 'husky', 'master': 'Jim'}
Xiaoming = {'name': 'Xiaoming', 'type': 'poodle', 'master': 'Sam'}
pets = [Dabao, Xiaobao, Xiaoming]
for pet in pets:
	print('\nName is ' + pet['name'])
	print('Type is ' + pet['type'])
	print('Master is ' + pet['master'])

6-11 城市

cities = {
	'Beijing': {
		'country': 'China',
		'population': '21 million',
		'fact': 'The capital of China',
		},
	'Washington': {
		'country': 'the USA',
		'population': '681 thousand',
		'fact': 'The capital of the USA'
		},
	'Moscow': {
		'country': 'Russia',
		'population': '14 million',
		'fact': 'The capital of Russia'
		},
	}
for city_name, city_info in cities.items():
	print('\nCityname: ' + city_name)
	print('Population: ' + city_info['population'])
	print('Fact: ' + city_info['fact'])

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值