Commit 4baba8c3 by BellCodeEditor

save project

parent 1775a62d
Showing with 12 additions and 4 deletions
def new_input(): def new_input():
g=[] g=0
while true: while True:
unit=input("你要点什么菜") unit=input("请输入数字")
if unit=="p": if unit=="p":
break break
else: else:
g.append(unit) try:
unit1=int(unit)
except:
print("格式错误,输入整数!")
else:
g=g+unit1
return g
c=new_input()
print(c)
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