forked from tdwojak/Python2017
Update 'labs02/task04.py'
This commit is contained in:
parent
50e576e7d9
commit
d2eeea8a25
@ -7,9 +7,12 @@ Jeśli podany argument jest mniejszy od 1 powinna być zwracana wartość 0.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def sum_from_one_to_n(n):
|
def sum_from_one_to_n(n):
|
||||||
|
if n<1:
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
return n*(n+1)/2
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def tests(f):
|
def tests(f):
|
||||||
inputs = [[999], [-100]]
|
inputs = [[999], [-100]]
|
||||||
outputs = [499500, 0]
|
outputs = [499500, 0]
|
||||||
|
Loading…
Reference in New Issue
Block a user