在Jupyter notebook里面新建一个python文件。
简单地定义一个FUNCTION函数。
def function1(): print("this is function1") print("function1 is here") print("out of the function1")
然后调试function1()就可以看到该函数里面的内容。
this is function1 function1 is here
相关推荐:《Python教程》
定义FUNCTION函数后,可以不断重复使用。
FUNCTION括号里面还可以增加数字。
def function2(x): return 2*x hoo = function2(8) print(hoo)
结果如下:
16
FUNCTION括号里面可以存在两个数字。
def function4(x, y): return x - y woo = function4(8, 5) print(woo)
结果如下:
3
FUNCTION函数可以同时定义PRINT和括号里的值。
def function5(x): print(x) print("this is function5") return 2*x tooooo = function5(8) print(tooooo)
结果如下:
16
常见问题FAQ
- 免费下载或者VIP会员专享资源能否直接商用?
- 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
- 提示下载完但解压或打开不了?
- 找不到素材资源介绍文章里的示例图片?
- 模板不会安装或需要功能定制以及二次开发?
发表评论
还没有评论,快来抢沙发吧!