Commit 707e6582 by BellCodeEditor

auto save

parent caf46cda
def sum(x,y):
z = x + y
return z
a = sum(10,20)
print("两数之和为:",a)
\ No newline at end of file
......@@ -4,4 +4,4 @@ data = func.new_input() # 模块名称.函数名称()
result = func.amont(data)
print("总金额是:",result)
print("总分数是:",result)
......@@ -12,10 +12,11 @@ def new_input():
print("请输入整数!")
else:
total.append(int(unit))
print(total)
#print(total)
return total # return 返回total给调用
# 调用函数
price_list = new_input() # price_list 是接收函数返回值
#price_list = new_input() # price_list 是接收函数返回值
#print(price_list)
def amont(money): # 形式参数只是在定义函数时写上
sm = 0
......@@ -23,8 +24,8 @@ def amont(money): # 形式参数只是在定义函数时写上
sm += i
return sm
result = amont(price_list) # 调整用函数时,要根据"形式参数"个数来赋值"实际参数"
print("总金额是:",result)
#result = amont(price_list) # 调整用函数时,要根据"形式参数"个数来赋值"实际参数"
#print("总金额是:",result)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment