习题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]))
这就是第四题,至于第二题,暂时没找的答案,希望在座的各位有了解的解释一下