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(): def new_input(): #定义第一个模块,收集数据
total = [] col=[] #col:collection(收集)
while True: while True:
unit = input('请输入(q退出):') data=input("请输入数据:")
if unit == 'q': if data=="stop":
break break
else: else:
try: try:
unit = int(unit) data_1=int(data)
except: except:
print("请重新输入一个数字") print("注意格式,请输入数字!")
else: else:
total.append(unit) col.append(data_1)
print("-"*30) print("____________________")
print(total) return col
new_input() #调用函数
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