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))
自己试试 »
If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]
If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]