Donnerstagabend

This commit is contained in:
2022-11-24 17:59:17 +01:00
parent 20066fe48d
commit aea7c693d6
7 changed files with 100 additions and 11 deletions

14
Donnerstag/fakultät.py Normal file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env python3
from decorators import counter, get_counter
@counter
def fak(n):
if type(n) is not int or n < 0:
raise TypeError("Illegal type")
if n == 0:
return 1
return n * fak(n-1)
print("6! =", fak(6))
print("Anzahl Aufrufe:", get_counter(fak))