Skip to content

Instantly share code, notes, and snippets.

@mvallebr
Created January 23, 2021 21:46
Show Gist options
  • Select an option

  • Save mvallebr/703cec57aa192fc17daa22e632c96808 to your computer and use it in GitHub Desktop.

Select an option

Save mvallebr/703cec57aa192fc17daa22e632c96808 to your computer and use it in GitHub Desktop.
def reverse_number(n):
multiplier = 1
result = 0
while n != 0:
if n > 0:
last = n % 10
n = n // 10
else:
last = n % 10 - 10
n = n // 10 + 1
result = 10 * result + last
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment