Commit 493fee0f by BellCodeEditor

save project

parent 3607feea
Showing with 15 additions and 31 deletions
def new_input(): total = []
total = [] while True:
while True: unit= input("请输入:")
unit=input("请输入:") if unit== 'q':
if unit== 'q': break
break else:
else: total.append(unit)
try: print(total)
unit=int(unit) \ No newline at end of file
except:
unit= input("请输入:")
else:
total.append(unit)
return total
a=new_input()
for i in range(lan(a)):
sum+=a[i]
print(sum)
...@@ -5,14 +5,8 @@ def new_input(): ...@@ -5,14 +5,8 @@ def new_input():
if unit== 'q': if unit== 'q':
break break
else: else:
try: int(unit)
unit=int(unit) total.append(unit)
except: print(total)
unit= input("请输入:") while True:
else: new_input()
total.append(unit) \ No newline at end of file
return total
a=new_input()
for i in range(lan(a)):
sum+=a[i]
print(sum)
\ 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