I'm new to python, I'm using v2.7
#Filename:ReverseNumber.py
data=int(raw_input("Enter any number: "))
print "Reverse of the number: ",
while data!=0:
a=data%10
print a,
data=data/10
So the output should come like :
Enter any number: 123
Reverse of the number: 321
but instead of this in the second line it is printing one extra space before every number.
How to overcome this?
print str(data)[::-1]?