Commit cedc26e8 by BellCodeEditor

save project

parent ab65305d
Showing with 21 additions and 6 deletions
...@@ -5,6 +5,22 @@ def ne(): ...@@ -5,6 +5,22 @@ def ne():
if unit== 'q': if unit== 'q':
break break
else: else:
try:
unit=int(unit)
except:
print('要输入整数啊')
else:
total.append(unit) total.append(unit)
print(total) return total
ne() def sum(unit):
\ No newline at end of file c=0
for i in unit:
c=c+i
return c
unit=ne()
pay=sum(unit)
print("需要支付"+str(pay)+"元")
try: try:
age = int(input('你今年几岁了?')) age = int(input('你今年几岁了?'))
except:
print('程序结束')except:
print('要输入整数啊') print('要输入整数啊')
\ No newline at end of file
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