Commit 44b8f173 by BellCodeEditor

auto save

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