Created
February 1, 2018 12:24
-
-
Save Fhernd/f099a6634a608d2dbe5ff863c48d0ed6 to your computer and use it in GitHub Desktop.
Definición de funciones 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 cubo_tres(): | |
""" | |
Retorna el cubo de 3. | |
""" | |
return 3 * 3 | |
print(cubo_tres()) | |
print() | |
def factorial(num): | |
""" | |
Calcula el factorial de un número dado. | |
""" | |
fact = 1; | |
idx = 1; | |
while idx <= num: | |
fact *= idx | |
idx += 1 | |
return fact | |
print(factorial(7)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment