#《Python编程从入门到实践》,动手试一试,5-11序数,答案。2023-07-15,by qs。
numbers = [1,2,3,4,5,6,7,8,9]
for number in numbers:
if number == 1:
print(str(number) + ' 1st')
elif number == 2:
print(str(number) + ' 2nd')
elif number == 3:
print(str(number) + ' 3rd')
else:
print(str(number) + ' ' +str(number)+'th')
Python编程从入门到实践_5-11 序数_答案