Created
January 18, 2019 18:18
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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