笨方法学python 习题34

习题34
python:3.9

animals = ['bear','python','peacock','kangaroo','whale','platypus']

print ("The animal at 1 is the  2nd animal  and is a  python.")
print ("The 3rd animal is at 2 and is a peacock .")
print ("The 1st animal is at 0 and  is  a bear.'")
print ("The animal at 3 is the 4th animal and is a  kangaroo.")
print ("The  5th animal is at 4 and is a whale.")
print ("The animal at 2 is the 3rd animal and is a peacock.")
print ("The 6th animal  is at 5 and is a platypus.")
print ("The animal at 4 is the 5th animal and is a whale.")

这个是我写的,然后我找了别的答案,发现一位大佬,给大家看看
习题34
加分习题
1.上网搜索一下关于序数(ordinal number)和基数(cardinal number)的知识并阅读一下。
序数(ordinal number)和基数(cardinal number)
2.以你对于这些不同的数字类型的了解,解释一下为什么 “January 1, 2010” 里是 2010 而不是2009?(提示:你不能随机挑选年份。)

3.再写一些列表,用一样的方式作出索引,确认自己可以在两种数字之间互相翻译。
4.使用 python 检查自己的答案

animals = ['bear','python','peacock','kangaroo','whale','platypus']

for i in range(0,6):
    print (" The animal at %d is the %dst animal and is  a  %s."%(i ,i+1,animals[i]))

这就是第四题,至于第二题,暂时没找的答案,希望在座的各位有了解的解释一下

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值