Commit 29346e48 by BellCodeEditor

auto save

parent a3655667
Showing with 32 additions and 0 deletions
def price():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
try:
total.append(int(unit))
except:
print("输入数字哦")
else:
print("继续输入")
return total
def sum(list):
count=0
for i in list:
count+=i
return count
result=price()
b=sum(result)
print(b)
\ No newline at end of file
try:
age=int(input("输入年龄"))
except:
print("请输入数字哦")
else:
if age>18:
print("恭喜已经成年")
print("结束")
\ 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