Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created May 30, 2021 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/32daed8f1f1f9bf1c18ec8829906f86c to your computer and use it in GitHub Desktop.
Save parzibyte/32daed8f1f1f9bf1c18ec8829906f86c to your computer and use it in GitHub Desktop.
"""
https://parzibyte.me/blog
"""
def invertir_numero(n):
numero = 0
while n != 0:
numero = 10*numero+n % 10
n //= 10
return numero
# Modo de uso
numero = 2811
numero_invertido = invertir_numero(numero)
print(f"El número {numero} es {numero_invertido} al invertirse")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment