导语:
本文主要介绍了关于function python怎么用的相关知识,包括pythonconvert函数,以及python return这些编程知识,希望对大家有参考作用。
在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
定义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
本文为原创文章,版权归知行编程网所有,欢迎分享本文,转载请保留出处!
你可能也喜欢
- ♥ Python判断一个字符是字母还是数字08/14
- ♥ 如何在python中传递参数12/12
- ♥ Python3代码可以用py2exe加密吗?10/30
- ♥ python中迭代器有什么用10/08
- ♥ Python重要的图数学算法教程12/15
- ♥ Python代码常用功能,精心整理版01/02
内容反馈