欢迎光临散文网 会员登陆 & 注册

黑马博学谷python+大数据2022开发

2022-09-20 23:15 作者:芢依稀久忆0  | 我要投稿

创建函数

在 Python 中,使用 def 关键字定义函数:

实例

def my_function():  print("Hello from a function")

调用函数

如需调用函数,请使用函数名称后跟括号:

实例

def my_function():  print("Hello from a function") my_function()

def my_function(fname):  print(fname + " Gates") my_function("Bill") my_function("Steve") my_function("Elon")

黑马博学谷python+大数据2022开发的评论 (共 条)

分享到微博请遵守国家法律