首页 > 其他 > 详细

函数的定义与调用

时间:2018-09-25 20:30:01      阅读:158      评论:0      收藏:0      [点我收藏+]
# _*_ coding: utf-8 _*_

# 定义函数的三种方式
# 有参函数
# def function0(x):
# print(‘%s‘ % (x + 1))
#
# function0(2)

# 无参函数
# def function1():
# print(‘hello world‘)
#
# function1()

# 空函数
‘‘‘
def registration():
pass
def login():
pass
def exit():
pass
def shoppint():
pass
‘‘‘


# 函数调用的三种形式
# 1
# registration() 直接调用函数名

# 2
# def max2(x, y):
# if x > y:
# print(type(x))
# return x
# else:
# return y

#
# res = max2(7, 1) * 12 #直接在表达式中使用
# print(res)

# 3
# res = max2(max2(10,20),30)
# print(res)

函数的定义与调用

原文:https://www.cnblogs.com/OutOfControl/p/9703020.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!