Create a Python program that allows the user to enter a number and reverses it. If the
number entered 45632, the program must produce the following output: 23654.
this is my answer but i dont know how to write a code to get the reverse of a negative number :-123 reversed number -321.
num = int(input(‘nEnter a number: ‘))
reversed_num = 0
while num != 0:
digit = num % 10 # remainder of the number inputted from the user divided by 10.
reversed_num = reversed_num * 10 + digit # Variable value changed. it is changed to its value
# multiplied by 10 plus the value of digit
num //= 10 # rounds the number down to the nearest whole number. This keeps the loop from becoming an infinite loop.
print(“nReversed Number: ” + str(reversed_num)) # prints the number as a string and not a value