some new things, mostly not working or finished
This commit is contained in:
18
functions/summe.py
Normal file
18
functions/summe.py
Normal file
@@ -0,0 +1,18 @@
|
||||
def summe(n) -> float:
|
||||
lst = []
|
||||
for i in range(1,n):
|
||||
lst.append(i)
|
||||
formatted = " + ".join(str(x) for x in lst)
|
||||
print(f"summe = {formatted} ; sum = {total(lst)}")
|
||||
|
||||
def total(lst: list) -> float:
|
||||
total = None
|
||||
for i in lst:
|
||||
i += total
|
||||
if total:
|
||||
return total
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
summe(10)
|
||||
Reference in New Issue
Block a user