python编程从入门到实践课后题答案-python编程从入门到实践第三章习题答案

3.1-3.2names = ['zhichao' , 'yujie' , 'yifei']

for name in names:

print( name.title() + " , good night.")3.3transportation = ['car' , 'walk', 'bicycle' , 'motorcycle']

for elem in transportation :

print( "I would like to own a Honda motorcycle " + elem )3.4-3.7#3.4部分people = ['宙斯' , '赫拉' , '雅典娜' , '阿芙洛蒂忒' ]for person in people :

print( person + " , I want to have a dinner with you." )

#3.5部分

unable = '宙斯'

new_one = '海伦'

print( unable + " can't participate in." )

print ( 20 * "*")unable = '宙斯'

new_one = '海伦'

people.remove( unable )#3.6部分

people.append( new_one )

people.insert( 0,'阿波罗')

people.insert( 3,'阿瑞斯' )

for person in people :

print( person + " , I want to have a dinner with you." )print ( 20 * "*")

#3.7部分while len( people ) > 2 :

people.pop()

for person in people :

print( person + " , I want to have a dinner with you." )i = len(people) -1

while i > 0 :

del people[i]

i = len( people )-1

3.8place = ['England' , "Greece" , 'America' , 'France']

print( place )

print( sorted( place ) )

print( place )

print( sorted( place , reverse = True ) )

print( place )

place.reverse()

print( place )

place.reverse()

print( place )

place.sort()

print( place )

place.sort( reverse = True )

print( place )

3.9这个已经在3.4-3.7的代码块中展示过

3.10-3.11 略

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值