Skip to content

Instantly share code, notes, and snippets.

@Mdslino
Created March 23, 2018 16:28
Show Gist options
  • Save Mdslino/41a8e0b94d7627e8a4bb3d5e25362a1e to your computer and use it in GitHub Desktop.
Save Mdslino/41a8e0b94d7627e8a4bb3d5e25362a1e to your computer and use it in GitHub Desktop.
n = 11
while n < 0 or n > 10:
n = int(input("Digite um número entre 0 e 10: "))
def factorial(n):
if n < 1: # base case
return 1
else:
return n * factorial(n - 1)
for i in range(1, n + 1):
print("{0}! = {1}".format(i, factorial(i)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment