added sql stuff
This commit is contained in:
22
Freitag/fakultät.py
Normal file
22
Freitag/fakultät.py
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
from decorators import counter, get_counter, trace
|
||||
|
||||
|
||||
@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))
|
||||
|
||||
@trace
|
||||
def fak(n):
|
||||
if n == 0:
|
||||
return 1
|
||||
return n * fak(n-1)
|
||||
|
||||
print(fak(4))
|
||||
Reference in New Issue
Block a user