Python 函式返回值
返回值
要讓函式返回值,請使用 return
語句。
示例
def my_function(x)
return 5 * x
print(my_function(3))
print(my_function(5))
print(my_function(9))
自己動手試一試 »
要讓函式返回值,請使用 return
語句。
def my_function(x)
return 5 * x
print(my_function(3))
print(my_function(5))
print(my_function(9))
自己動手試一試 »
如果您想將 W3Schools 服務用於教育機構、團隊或企業,請傳送電子郵件給我們
sales@w3schools.com
如果您想報告錯誤,或想提出建議,請傳送電子郵件給我們
help@w3schools.com