Python函数
""" 声明函数: def <函数名>(参数列表): <函数语句> return <返回值> 参数列表的返回值不是必须的, return可以不跟返回值,也可以没有,但是返回值为None。 """ #例: def hello(): #函数名为hello,无参数 print('hello python') #缩进后的语句后,表示该函数内的语句
# 2.向函数传递信息 def greet_user(username): print("Hello," + username.title() + "!") greet_user("阿猛")

浙公网安备 33010602011771号