return example 4
This commit is contained in:
parent
0ae054b0e5
commit
fa0b7c73b8
11
python-temel/return.4.py
Normal file
11
python-temel/return.4.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
def gettotal(l):
|
||||
total = 0
|
||||
for i in l:
|
||||
total += i
|
||||
return total
|
||||
|
||||
result = gettotal([1, 2, 3, 4, 5])
|
||||
print(result)
|
||||
|
||||
result = gettotal(range(10))
|
||||
print(result)
|
Loading…
Reference in New Issue
Block a user