'''
#创建函数
def hello(name):
return 'hello,%s' % name
print(hello('xuuyoujia'))
##文档化函数
def squre(nm):
'Calculates the square of the number nm'
return nm*nm
print(squre(2))
def print_param1(x,y=2):
print(x,y)
def print_param2(x=1,y=2,z=3):
print(x,y,z)
def print_param3(*params):
print(params)
def print_param4(**params):
print(params)
def print_param5(x,y,*params1,**params2):
print(x)
print(y)
print(params1)
print(params2)
#print_param1(1,3)
#print_param1(1)
print_param2()
print_param3(1,2,3,4,5)
print_param4(x=1,aa=2,cc=3,dd=4)
print_param5(1,2,3,4,5,6,5,z=1,h=3)
#print_param5(1,2,3,4,x=1,y=3,5,6,5)#positional argument can not appear after keywords argument
print_param5(1,2,3,4,5,6,5,z=1,h=3)
#作用域
'''
递归:函数可以调用自身,一切用递归实现的功能都可以用循环实现,只不过有些时候递归函数更易读
函数式编程:lambda表达式以及map,filter和reduce
lambda在数学中表示匿名函数
评论