numbers = (1,2,3,4,5,6,7,8,9)
for list in numbers :
if list==1 :
print("1" + "st")
elif list==2 :
print("2" + "nd")
elif list==3 :
print("3" + "rd")
else :
print(list + "th")
이렇게 하면 TypeError: unsupported operand type(s) for +: 'int' and 'str'
해당 오류가 나옵니다.
결과를
1st
2nd
3rd
4th
5th
6th
7th
8th
9th
이렇게 나오게 하고 싶은데 어떻게 해야할까요?