#6-3 词汇表:

代码:#6-3 词汇表

dic = {

'': 'Vectors are sequence containers representing arrays that can change in size.',

'': 'Stacks are a type of container adaptor, specifically designed to operate in '

'a LIFO context (last-in first-out), where elements are inserted and extracted only from one end of the container.',

'': 'Maps are associative containers that store elements formed by a combination of a '

'key value and a mapped value, following a specific order.',

'': 'Sets are containers that store unique elements following a specific order.',

'': 'queues are a type of container adaptor, specifically designed to operate in a'

' FIFO context (first-in first-out), where elements are inserted into one end of the container and extracted from the other.',

}

for key, value in dic.items():

print(key, ':', value, '\n')

输出: : Vectors are sequence containers representing arrays that can change in size.

: Stacks are a type of container adaptor, specifically designed to operate in a LI

FO context (last-in first-out), where elements are inserted and extracted only from one en

d of the container.

: Maps are associative containers that store elements formed by a combination of a k

ey value and a mapped value, following a specific order.

: Sets are containers that store unique elements following a specific order.

: queues are a type of container adaptor, specifically designed to operate in a FI

FO context (first-in first-out), where elements are inserted into one end of the container

and extracted from the other.

#6-5 河流:

代码:#6-5 河流

rivers = {

'nile': 'egypt',

'amazon': 'brazil',

'thames': 'england',

}

for river, country in rivers.items():

message = 'The ' + river.title() + ' runs through ' + country.title()

print(message)

print('\n')

for river in rivers.keys():

print(river.title())

print('\n')

for country in rivers.values():

print(country.title())

输出:The Nile runs through Egypt

The Amazon runs through Brazil

The Thames runs through England

Nile

Amazon

Thames

Egypt

Brazil

England

#6-8 宠物:

代码:#6-8 宠物

dogs = {

'Affenpinscher': 'Smiths',

'Afghan Hound': 'Bob',

'Aidi': 'Peter',

}

cats = {

'Bobtail': 'Lory',

'American Shorthair': 'Peter',

'Bombay': 'Tom',

}

birds = {

'Canary': 'Lory',

'Budgy': 'Tom',

'Cockatiel': 'Bob',

}

pets = [dogs, cats, birds]

for pet in pets:

for name, owner in pet.items():

message = owner + ' has '

if name[0] in 'AOEIU':

message += 'an '

else:

message += 'a '

message += name

print(message)

输出:Smiths has an Affenpinscher

Bob has an Afghan Hound

Peter has an Aidi

Lory has a Bobtail

Peter has an American Shorthair

Tom has a Bombay

Lory has a Canary

Tom has a Budgy

Bob has a Cockatiel

#6-11 城市:

代码:#6-11 城市

Los_Angeles = {

'country': 'USA',

'population': '3,971,883',

'fact': 'It is home to the Wilshire Grand Center, California’s tallest Building.',

}

Guangzhou = {

'country': 'China',

'population': '13,501,100',

'fact': '2008 The 49th World Table Tennis Championships.',

}

Tokyo = {

'country': 'Japan',

'population': '9,262,046',

'fact': 'In 2016, it was to be replaced by the New National Stadium.',

}

cities = {

'Los Angeles': Los_Angeles,

'Guangzhou': Guangzhou,

'Tokyo': Tokyo,

}

for city, dic in cities.items():

message = '\n' + city + ':'

print(message)

for key, value in dic.items():

message = ' ' + key + ': ' + value

print(message)

输出:Los Angeles:

country: USA

population: 3,971,883

fact: It is home to the Wilshire Grand Center, California’s tallest Building.

Guangzhou:

country: China

population: 13,501,100

fact: 2008 The 49th World Table Tennis Championships.

Tokyo:

country: Japan

population: 9,262,046

fact: In 2016, it was to be replaced by the New National Stadium.

python第二版第六章课后答案_《Python编程》第六章部分课后练习题相关推荐

  1. mysql数据库应用与开发姜桂洪 课后答案_数据库应用与开发姜桂洪课后答案

    数据库应用与开发姜桂洪课后答案 设有关系模式r(a,b,c,d),其数据依赖集:f={(a,b)→c,c→d},则关系模式r的规范化程度最高达到( ). 谓词all以子表达式最大值决定主表达式结果 行 ...

  2. java项目开发教程课后答案_《JavaWeb程序开发入门》课后题

    第一章 1.请编写一个格式良好的XML文档,要求包含足球队一支,队名为Madrid,球员5人:Ronaldo.Casillas.Ramos.Modric.Benzema:篮球队一支,队名为Lakers ...

  3. 黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第四章 使用SCAPY掌控网络(2)Scapy实现ARP缓存投毒

    黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第四章 使用SCAPY掌控网络(2)Scapy实现ARP缓存投毒 文章目录 黑帽python第二版(Bl ...

  4. 黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第一章 配置python环境

    黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第一章 配置python环境 文章目录 黑帽python第二版(Black Hat Python 2nd ...

  5. 黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第五章 WEB黑客(3)暴力破解目录与文件位置

    黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第五章 WEB黑客(3)暴力破解目录与文件位置 文章目录 黑帽python第二版(Black Hat P ...

  6. 黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第五章 WEB黑客(4)暴力破解HTML表单身份验证

    黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第五章 WEB黑客(4)暴力破解HTML表单身份验证 文章目录 黑帽python第二版(Black Ha ...

  7. 黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第三章 网络工程-原始套接字与嗅探(1)主机发现工具与包嗅探

    黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第三章 网络工程-原始套接字与嗅探(1)主机发现工具 文章目录 黑帽python第二版(Black Ha ...

  8. 黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第十一章 攻击性取证

    黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第十一章 攻击性取证 文章目录 黑帽python第二版(Black Hat Python 2nd Edi ...

  9. 黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第八章 Windows常见特洛伊木马任务(1)有趣的键盘记录器

    黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第八章 Windows常见特洛伊木马任务(1)有趣的键盘记录器 文章目录 黑帽python第二版(Bla ...

  10. 黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第八章 Windows常见特洛伊木马任务(4)沙箱检测

    黑帽python第二版(Black Hat Python 2nd Edition)读书笔记 之 第八章 Windows常见特洛伊木马任务(4)沙箱检测 文章目录 黑帽python第二版(Black H ...

最新文章

  1. android 反编译
  2. 【pmcaff专栏】一个“Uber”血染中国共享经济
  3. 【数据竞赛】Kaggle竞赛宝典国内外竞赛方案汇总
  4. 关于Log 的一些东西
  5. 怎样的项目才能称为“成功项目”?
  6. linux 拿shell,linux下备份拿shell[渗透必备]
  7. makefile中的patsubst, wildcard, notdir
  8. 542. 01 Matrix
  9. 【计算机网络复习 物理层】2.1.1 物理层基本概念
  10. 阿里云助力江苏省财政厅力推统一公共支付平台
  11. Mac开发者福利来了!安利一波各领域不错的软件工具
  12. 苹果id退出后数据还在吗_【保留数据修复】升级iOS 14后,出现白苹果的修复方法!...
  13. t6服务器验证密码失败,用友T6软件T6服务无法启动,提示SA密码错误
  14. 欠款人署名故意签错,怎么维权
  15. 成为一个好的PHP工程师需要掌握什么技能
  16. 《那些年啊,那些事——一个程序员的奋斗史》——123
  17. 项目2-企业级电商平台的搭建--填坑过程
  18. (萌新笔记)python的复习笔记
  19. oracle 通过身份证号 查询年龄大于60岁的人
  20. 知名企业面试、笔试题

热门文章

  1. OA中总结:s:select,关于使用modelDriven,项目分层,@Transactional,jspf,各个层上配置注解交给spring管理的方法,简单的OGNL表达式写法
  2. primer premier 5 64位_王者荣耀:必出破军的3位英雄,玩他们不出破军?说明你是个菜鸟!...
  3. 移动时捕捉不到基点_CAD入门学习攻略:CAD软件中对象捕捉功能使用技巧汇总
  4. 去掉烦人的“正在配置Windows”
  5. BAT集体升级云事业部,这背后都藏着哪些“小心思”?
  6. 关于Exchange邮箱服务器角色故障排查及解决思路分享
  7. 《C语言点滴》一1.5 内功修炼
  8. C#MysqlHelper
  9. 新事务不能登记到指定的事务处理器中异常的处理----MSDTC的正确配置
  10. SQL Server数据归档的解决方案