0
Can anyone tell me how to write a simple PYTHON program to reverse a 3 or 4 digit number???
Example :123~321
3 Respostas
+ 6
- input a number as a string or convert an integer to a string (str)
- reverse the string ([::-1])
- convert it to an integer (int)
+ 4
num = 123
num2 = int(str(num)[::-1])
print(num2) #321
+ 2
Or the stupid way
https://code.sololearn.com/cJM2rP7nIKjT/?ref=app