def add(a, b):
return a + b
def add(a, b):
return a + b
add(1, 10)
def add(a, b = 1):
return a + b
add(10)
def add(a, b):
return a + b
add(b = 10, a = 1)
def add(*args):
total = 0
for i in args:
total += i
return total
add(1, 2, 3, 4)
def check(d):
return d > 0, d == 0, d < 0
gt, eq, lt = check(10)
print(gt, eq, lt)
# 元组
one, two = (1, 2)
# -> 1, 2
# 数组
one, two = [1, 2]
# -> 1, 2
# 字典
m = { 'name': 'c', 'age': 12 }
name, age = m
# -> 'name', 'age'
name, age = m.keys()
# -> 'name', 'age'
name, age = m.values()
# -> 'c', 12