Commit 1fbd6dfc by BellCodeEditor

auto save

parent 024fb164
Showing with 14 additions and 0 deletions
def total():
str1=[]
while True: #利用while True 去实现重复询问价格
a=input("请输入价格") #input实现互动效果
try:
a1=int(a) #尝试转化成int型
except:
print("请输入整数") #转化失败执行的行为
else
str1.append(a1) #成功执行的操作
total()
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