demet eleman fonksiyon
This commit is contained in:
parent
61039b38d5
commit
c5b0de1f2b
12
python-temel/demet.eleman.fonksiyon.py
Normal file
12
python-temel/demet.eleman.fonksiyon.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
def add(*a):
|
||||
total = 0
|
||||
for x in a:
|
||||
if isinstance(x, (list, tuple)):
|
||||
total += sum(x)
|
||||
else:
|
||||
total += x
|
||||
return total
|
||||
|
||||
x = [20, 30]
|
||||
result = add(10, x, 40)
|
||||
print(result)
|
Loading…
Reference in New Issue
Block a user