Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created February 1, 2018 12:24
Show Gist options
  • Save Fhernd/f099a6634a608d2dbe5ff863c48d0ed6 to your computer and use it in GitHub Desktop.
Save Fhernd/f099a6634a608d2dbe5ff863c48d0ed6 to your computer and use it in GitHub Desktop.
Definición de funciones en Python.
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