Ai
1 Star 0 Fork 0

小学肄业/Python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ex9_function.py 529 Bytes
一键复制 编辑 原始数据 按行查看 历史
小学肄业 提交于 2018-11-06 20:11 +08:00 . 基本使用
#function def nanme(): 下定义
#如果函数有返回值可以如下写法
#def function(a, b):
# return a + b
def function1():
print("hello world")
function1()
def sum(num1, num2):
print("num1 + num2 = " + str(num1 + num2))
sum(10, 20)
def sum1(num1, num2):
return num1 + num2
a = sum1(10, 20)
print(a)
#带有默认值的函数
def convert(weight):
ponds = weight / 0.45
print(ponds)
def convert2(weight = 100):
ponds = weight / 0.45
print(ponds)
convert(100)
convert2()
convert2(weight=200)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/nuc_five/Python.git
git@gitee.com:nuc_five/Python.git
nuc_five
Python
Python
master

搜索帮助