用户:
编程猫深圳南山滨海校区查看:17 回复:0 评论:0 创建时间:2019-07-24T17:29:26
【作品展示】

【作品介绍】
猜生日的月份
【作品源代码】
import baseFunc
# 初始化列表
list1 = [1, 3, 5, 7, 9, 11]
list2 = [2, 3, 6, 7, 10, 11]
list3 = [4, 5, 6, 7, 12]
list4 = [8, 9, 10, 11, 12]
#根据反馈计算生日在哪一个月份
def calMonth():
i = bDate = 0
while i < 4:
if i == 0:
a = baseFunc.queryDate(1, list1)
if a == "Y" or a == "y":
bDate = bDate + 1 * 2 ** 0
elif i == 1:
a = baseFunc.queryDate(1, list2)
if a == "Y" or a == "y":
bDate = bDate + 1 * 2 ** 1
elif i == 2:
a = baseFunc.queryDate(1, list3)
if a == "Y" or a == "y":
bDate = bDate + 1 * 2 ** 2
else:
a = baseFunc.queryDate(1, list4)
if a == "Y" or a == "y":
bDate = bDate + 1 * 2 ** 3
i += 1
return bDate
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn