def bi(a):
if a >18:
return print("c")
else:
return print("n")
bi(16)
def sss(c):
if c>16:
return print("q")
elif c>18:
return print("c")
else:
return print("children")
sss(2)

可以看见定义的格式

本文探讨了Python中函数的定义方式,包括参数传递和返回值处理,并通过实例展示了如何使用条件语句进行逻辑判断。通过对两个不同函数的解析,读者可以了解基本的编程逻辑和流程控制。
def bi(a):
if a >18:
return print("c")
else:
return print("n")
bi(16)
def sss(c):
if c>16:
return print("q")
elif c>18:
return print("c")
else:
return print("children")
sss(2)

可以看见定义的格式


被折叠的 条评论
为什么被折叠?