Created
March 23, 2018 16:28
-
-
Save Mdslino/41a8e0b94d7627e8a4bb3d5e25362a1e to your computer and use it in GitHub Desktop.
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
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