Commit 896e14ed by BellCodeEditor

auto save

parent 73425e1b
#第一关创建函数
def n_w():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
try:
unit = int(unit)
except:
print("number:")
else:
total.append(unit)
return total
a = n_w()
print(a)
......@@ -5,14 +5,7 @@ def n_w():
if unit== 'q':
break
else:
# total.append(unit)
try:
unit = int(unit)
except:
print("请重新输入一个数字")
else:
total.append(unit)
return total
a = n_w()
print(a)
total.append(unit)
print(total)
n_w()
......@@ -2,20 +2,26 @@ def n_w():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
if unit== 'q' or unit== 'Q':
break
else:
# total.append(unit)
try:
unit = int(unit)
except:
print("请重新输入一个数字")
else:
total.append(unit)
# print(total)
return total
a = n_w()
print(a)
# a = n_w()
# print(a)
#第四关:计算总价
......
......@@ -35,6 +35,7 @@ p.end_fill()
p.penup()
p.goto(0,50)
p.pendown()
#内切三角形的边长
len = (math.sqrt(3))*50
p.right(60)
......
# def a():
# total = []
# while True:
# unit= input("请输入:")
# if unit== 'q':
# break
# else:
# total.append(unit)
# print(total)
# a()
try:
age = int(input("年龄:"))
except:
print("要输入整数啊")
else:
if age<18:
print("你可以喝酒哦~")
print("哇哦")
\ No newline at end of file
......@@ -7,8 +7,7 @@ def n_w():
break
else:
total.append(unit)
print()
print()
n_w()
......
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