This is my code:
num = input('Amount of numbers:')
num = int(num)
for x in range(1, num + 1):
if x == 1:
print('1st')
elif x == 2:
print('2nd')
elif x == 3:
print('3rd')
elif x >= 4:
print(x, 'th')
This is the output(sample):
Amount of numbers:8
1st
2nd
3rd
4 th
5 th
6 th
7 th
8 th
As you can see, all numbers after 4 have a whitespace between it and 'th'. How do I fix this?