fork download
  1. def rev_num(num):
  2. reved_num = 0
  3. while num > 0:
  4. digit = num %10
  5. reved_num = reved_num * 10 + digit
  6. num //= 10
  7. return reved_num
  8.  
  9. num = int(input())
  10.  
  11. res = rev_num(num)
  12.  
  13. print(res)
  14.  
Success #stdin #stdout 0.01s 7396KB
stdin
521
stdout
125