新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:function python怎么用
在Jupyter notebook里面新建一個python文件。

創(chuàng)新互聯(lián)專注于龍巖企業(yè)網(wǎng)站建設(shè),自適應(yīng)網(wǎng)站建設(shè),商城網(wǎng)站建設(shè)。龍巖網(wǎng)站建設(shè)公司,為龍巖等地區(qū)提供建站服務(wù)。全流程按需定制制作,專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)
簡單地定義一個function函數(shù)。
def function1():
print("this is function1")
print("function1 is here")
print("out of the function1")然后調(diào)試function1()就可以看到該函數(shù)里面的內(nèi)容。
this is function1 function1 is here
相關(guān)推薦:《Python教程》
定義FUNCTION函數(shù)后,可以不斷重復(fù)使用。
FUNCTION括號里面還可以增加數(shù)字。
def function2(x): return 2*x hoo = function2(8) print(hoo)
結(jié)果如下:
16
FUNCTION括號里面可以存在兩個數(shù)字。
def function4(x, y): return x - y woo = function4(8, 5) print(woo)
結(jié)果如下:
3
FUNCTION函數(shù)可以同時定義PRINT和括號里的值。
def function5(x):
print(x)
print("this is function5")
return 2*x
tooooo = function5(8)
print(tooooo)結(jié)果如下:
16
分享題目:創(chuàng)新互聯(lián)Python教程:function python怎么用
URL地址:http://www.dlmjj.cn/article/cdohegc.html


咨詢
建站咨詢
