Commit b02e9e90 by BellCodeEditor

auto save

parent 7eaed43a
Showing with 35 additions and 0 deletions
def new_input():
total = []
while True:
unit = input("请输入:")
if unit == 'q':
break
else:
try:
unit = int(unit)
except:
print("请正确输入价格!")
else:
total.append(unit)
return total
list=new_input()
print(list)
\ No newline at end of file
# if 条件判断如果不加重复执行只会执行一次
# 但是如果加了重复执行条件会一直判断不会结束 除非结束循环
#while 当的意思
#while为当后面的条件成立 循环执行它里面的内容 如果后面的条件不成立 就不执行里面的内容循环结束
a = 3
while a<10:
print(a<10)
a = a + 1
a y/n
3<10 True
4<10 True
9<10 True
10<10 False
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