"""
选择语句 3.25 晚上
"""
"""
while循环
作用:可以让一段代码满足条件,重复执行
语法:
while 条件:
满足条件执行的语句
else:
不满足条件执行的语句
说明:
else可以省略不写
跳出循环 break
"""
# while 1:
# month = input("输入月份:")
# if not month.isdigit() or not int(month):
# print("输入错误")
# elif int(month) % 12 == 1 or int(month) % 12 == 2 or int(month) % 12 == 3:
# print("春")
# elif int(month) % 12 == 4 or int(month) % 12 == 5 or int(month) % 12 == 6:
# print("夏")
# elif int(month) % 12 == 7 or int(month) % 12 == 8 or int(month) % 12 == 9:
# print("秋")
# elif int(month) % 12 == 10 or int(month) % 12 == 11 or int(month) % 12 == 12:
# print("冬")
# elif month == "exit":
# break
"""
在控制台中输出:0 1 2 3 4 5
在控制台中输出:2 3 4 5 6 7
在控制台中输出:0 2 4 6
在控制台中输出:4 3 2 1 0
在控制台中输出:-1 -2 -3 -4 -5
"""
# count_1 = 0
# while count_1 < 6:
# print(count_1, end=",")
# count_1 += 1
#
# print()
#
# count_2 = 2
# while count_2 < 8:
# print(count_2, end=",")
# count_2 += 1
#
# print()
# count_3 = 0
# while count_3 < 7:
# print(count_3, end=",")
# count_3 += 2
#
# print()
# count_4 = 4
# while count_4 < 5 and count_4 >= 0:
# print(count_4, end=",")
# count_4 -= 1
#
# print()
#
# count_5 = -1
# while count_5 > -5:
# print(count_5, end=",")
# count_5 -= 1
"""
在控制台中,获取一个开始值,一个结束值。
将中间的数字打印出来
输入:3 9
输出:4 5 6 7 8
"""
# start_num = int(input("输入开始值"))
# end_num = int(input("输入结束值"))
# 这几行便于理解
# if start_num > end_num:
# start_num, end_num = end_num, start_num
# while start_num < end_num-1:
# start_num += 1
# print(start_num, end=",")
# 这几行的效果是一样的,但要动脑筋
# dir = 1 if start_num < end_num else -1
# while start_num != end_num -dir:
# start_num += dir
# print(start_num,end=",")
"""
一张纸的厚度是0.01毫米,珠穆朗玛峰的高度8844.43米
"""
# paper_thickness = 0.01 / 1000
# times = 0
# while paper_thickness < 8844.43:
# times += 1
# paper_thickness *= 2
# print("对折" + str(times) + "的高度是:" + str(paper_thickness))
"""
产生一个1-100随机数,让玩家重复猜测,知道猜对为止,
"""
# import random
# random_num = random.randint(1,100)
# num = None
# while num != random_num:
# num = int(input("输入一个数字猜大小:"))
# if num == random_num:
# print("猜对了")
# else:
# print("猜大了") if num > random_num else print("猜小了")