Commit dfe81f1c by BellCodeEditor

save project

parent 9bbd0d0a
Showing with 22 additions and 9 deletions
def new_input():
total = []
while True:
unit= input('请输入(q退出):')
if unit== 'q':
break
else:
try:
unit = int(unit)
except:
print("请输入整型")
total.append(unit)
print(total)
new_input()
\ No newline at end of file
with open(r"c:\Users\PC\Desktop\num.txt",'r',encoding="utf-8") as o:
try:
except as :
else:
with open(r"c:\Users\PC\Desktop\num.txt",'r',encoding="utf-8") as o:
a=o.readlines()
for i in a:
d=i.split()
c=d[1:]
e=d[0]
f=0
for i in c:
f+=int(i)
print(f)
\ No newline at end of file
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