Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created January 18, 2019 18:18
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/247580a89f5afd5666b7beb2f28d5ba5 to your computer and use it in GitHub Desktop.
Save parzibyte/247580a89f5afd5666b7beb2f28d5ba5 to your computer and use it in GitHub Desktop.
Función que dice si es entero en Python created by parzibyte - https://repl.it/@parzibyte/Funcion-que-dice-si-es-entero-en-Python
def es_entero(variable):
try:
int(variable)
return True
except:
return False
datos = ["123", "asd", "eeee", "----", "-5", ""]
for dato in datos:
print("¿'{}' es un entero? {}".format(dato, es_entero(dato)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment