Commit 1a12b134 by BellCodeEditor

save project

parent 7031a345
Showing with 26 additions and 0 deletions
def new_input():
list1=[]
while True:
data=input("请输入一串数字:")
if data=="stop":
break
else:
try:
data_1=int(data)
except:
print("输入错误,请输入数字!")
else:
list1.append(data_1)
print(list1)
return(list1)
new_data=new_input()
print(new_data)
def count(new_data):
total=0
for i in new_data:
total=total+i
print(total)
return(total)
count(new_data)
\ 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