python 函数编程

时间:2023-03-09 17:38:14
python 函数编程

def test1():
print('in the test1')

def test2():
print('in the test2')
return 1

def test3():
print('in the test3')
return 3,'hello',{'name':'Jason'},['1','2']

x = test1()
y = test2()
z = test3()

print(x)
print(y)
print(z)

-------------------函数传参--------------------

def test(x,y):
print(x)
print(y)

# test(1,2)
test(y=99,x=1)

--------------------参数组---------------------

def test(*args):