Commit 44b8f173 by BellCodeEditor

auto save

parent eb6ff489
try: #导入自己的模块
age=int(input("输入您的年龄:")) import func1
except : func1.new_input()
print("请输入一个整数") \ No newline at end of file
else:
if age <18:
print("不可以喝酒")
else:
print("饮酒要适度")
finally:
print(1)
def score(): #自定义函数
def new_input():
sum=0 #求和
total = [] total = []
while True: while True:
try: unit= input("请输入:")
unit= int(input("请输入:")) if unit== 'q':
except: break
print("请输入一个整数")
else: else:
if unit== "q": try:
break unit=int(unit)
except:
print("请输入一个整数")
else: else:
total.append(unit) total.append(unit)
for i in total:
print(total) sum=sum+i
score() return sum
\ No newline at end of file #调用函数
print(new_input())
\ 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