Norr Norr - 4 months ago 12
Python Question

Printing multiple objects without spaces

I'm writing a basic program to convert any 4 digit number in reverse.

I know I'm taking a very complex approach, but that's what my professor requires. So far I've got:

print("This program will display any 4-digit integer in reverse order")

userNum = eval(input("Enter any 4-digit integer: "))

num1 = userNum % 10

userNum2 = userNum // 10

num2 = userNum2 % 10

userNum3 = userNum // 100

num3 = userNum3 % 10

userNum4 = userNum // 1000

num4 = userNum4 % 10


The issue I'm having is the output from the print statement gives me

x x x x

When I would prefer to have


Any advice?


If you read the description of the print(), you can see that you can change your last line for:

print(num1,num2,num3,num4, sep='')