20 lines
410 B
Python
20 lines
410 B
Python
# Datei: sum_calculator.py
|
|
|
|
def calculate_cumulative_sum(limit):
|
|
"""
|
|
Soll die kumulative Summe von 0 bis limit berechnen.
|
|
"""
|
|
total = 0
|
|
|
|
for i in range(limit):
|
|
total += i
|
|
return total
|
|
|
|
if __name__ == "__main__":
|
|
test_number = 5
|
|
|
|
result = calculate_cumulative_sum(test_number)
|
|
|
|
print(f"Die Zahl ist: {test_number}")
|
|
print(f"Ergebnis der Summe: {result}")
|