Commit 493fee0f by BellCodeEditor

save project

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