Print reverse order

1

Given a number x, where 1000≤x

asked by anonymous 23.08.2018 / 02:10

2 answers

0

Try this:

x = float(input()) 
if (x >= 1000 and x < 10000):  
  y = str(x)
  print(y[::-1])
    
23.08.2018 / 02:38
-1

Here is a function to perform the inversion:

def reverse_number(n):
  r = 0
  while n > 0:
    r *= 10
    r += n % 10
    n /= 10
  return r
    
23.08.2018 / 02:15