Python3自定义函数

来源:互联网 发布:js字符串去掉换行符 编辑:程序博客网 时间:2024/05/02 04:27

自定义函数以def开头后接函数名称以及括弧()

括弧中添加参数

函数内容需要以冒号开始并有缩进

如自定义函数输出"hello world"

def hello():

print("hello world!")


hello()

hello world!