From 36e78f1dfaaa5a9294e1918449a78a2f8f39e02c Mon Sep 17 00:00:00 2001 From: s45147 Date: Sun, 19 Nov 2017 15:34:42 +0100 Subject: [PATCH] done --- labs02/task04.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/labs02/task04.py b/labs02/task04.py index 37413f1..08d4cc0 100644 --- a/labs02/task04.py +++ b/labs02/task04.py @@ -7,8 +7,14 @@ Jeśli podany argument jest mniejszy od 1 powinna być zwracana wartość 0. """ def sum_from_one_to_n(n): - pass + suma = 0 + for i in range(n+1): + suma = suma + i + if n < 1: + return 0 + else: + return suma def tests(f): inputs = [[999], [-100]]