Commit 296867ba by BellCodeEditor

save project

parent d6496461
import func
dance=func.new_input()
cscroce=func.sums(dance)
print(cscroce)
\ No newline at end of file
......@@ -8,8 +8,21 @@ def new_input():
try:
unit = int(unit)
except:
print("输入错误重新输入")
print("请重新输入一个数字")
else:
total.append(unit)
print("-"*30)
print(total)
new_input()
\ No newline at end of file
finally:
print("=====================")
return total
# 创建函数sum放入参数money
def sums(money):
# 设置变量count
count=0
# 遍历列表
for i in money:
# 计算总价
count=count+i
# 返回总数count
return count
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