formations/AlgoApprofondie/cours/code/factorielle.py

13 lines
230 B
Python
Raw Normal View History

def factorielle(n):
if (n > 1):
r = n*factorielle(n-1)
else:
r = 1
return r
def print_fact(n):
print "factorielle {} = {}\n".format(5, factorielle(5))
if __name__ == '__main__':
print_fact(5)