Commit 7605a80f by BellCodeEditor

auto save

parent 890f728d
M="周末去玩"
key="bxbcbhdhnjsiuissi"
import p #p是上一个自定义模块的文件名
collection=p.new_input()
zong=p.count(collection)
print("总分是"+str(zong)+"分")
\ No newline at end of file
def new_input():
total = []
def new_input(): #定义第一个模块,收集数据
col=[] #col:collection(收集)
while True:
unit = input('请输入(q退出):')
if unit == 'q':
data=input("请输入数据:")
if data=="stop":
break
else:
try:
unit = int(unit)
data_1=int(data)
except:
print("请重新输入一个数字")
print("注意格式,请输入数字!")
else:
total.append(unit)
print("-"*30)
print(total)
new_input() #调用函数
col.append(data_1)
print("____________________")
return col
back_data=new_input() #back_data:返回的数据
print(back_data)
def count(t): #count:计算总数
w=0
for i in t:
w=w+i
print(w)
return w
count(back_data)
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