1.先了解简单的函数:
#无参数
#定义函数hello
def hello():
print("hello")
print(len('hello'))
#调用函数
hello()
#-----------------------
#结果:
hello
5
#有参数
def fun1(name):
name="白白"
print("hello%s"%(name))
fun1(1)
#------------------------
#结果:
hello白白
def fun1(name):
# name="白白"
print("hello%s"%(name))
fun1(30)
fun1("hadoop")
#------------------------
#结果:
hello30
hellohadoop
def hello():
return "helllo"
res=hello()
print(res)
#------------------------
#结果:
helllo