1、bool值为false
0、false、‘’、()、[]、{} 、None
2、根据范围获取其中3和7整除的所有数的和
def func(start,end,a=0,b=0): if start==end: return a,b if(start%3==0 and start%7==0): a+=1 b+=start ret=func(start+1,end,a,b) return ret ret=func(30,70) print(ret) # (2, 105)
def func(x,z,y): print(x,y,z) func(1,3,2) # 1 2 3
def func(x,z,y=5): print(x,y,z) func(1,3,2) # 1 2 3
def func(x,*z,**y): print(x,y,z) func(1,3,2) # 1 {} (3, 2)
def func(*y,**z): print(y,z) func([1,2,3,4],{"name":"alex","age":19}) # ([1, 2, 3, 4], {'name': 'alex', 'age': 19}) {}
def func(*y,**z): print(y,z) func(*[1,2,3,4],{"name":"alex","age":19}) # (1, 2, 3, 4, {'name': 'alex', 'age': 19}) {}
def f1(arg): print(arg+100) def f2(arg): ret=f1(arg+1) print(arg) print(ret) ret=f2(7) print(ret) # 108 # 7 # None # None
def f1(arg): print(arg+100) return 100 def f2(arg): ret=f1(arg+1) print(arg) print(ret) return 200 ret=f2(7) print(ret) # 108 # 7 # 100 # 200
def func(n): if n==1: return 1 return n*func(n-1) f=func(3) print(f)