小编noo*_*bie的帖子

如何验证生日是否通过?

这跟我上一个问题类似.但在这里,我想知道如何知道一个人是否可以做某事,例如:

如果乔小于21,他就不允许喝酒,用生日告诉你他是否可以.不使用导入或日历,试图掌握它

到目前为止,这是我想出的.

dateStr = input("Today's Date: ")
monthStr, dayStr, yearStr = dateStr.split("/")
months = ["January", "February","March", "April", "May", "June", "July", "August","September","October", "November","December"]
monthStr = months[int(monthStr)- 1]
print ("The converted date is:", monthStr, dayStr+",", yearStr)
print("Joe did NOT have his birthday this year!")
Joe's birthday = True
for chr in dateStr:
  tv = True
  if:
    (i<= 13)
    print("Joe is Not allowed to watch TV.")
  else:
    print("Joe is allowed to watch TV.")
driving = True
if:
  (i<= 16)
    print("Joe is NOT …
Run Code Online (Sandbox Code Playgroud)

python if-statement date case

0
推荐指数
1
解决办法
125
查看次数

标签 统计

case ×1

date ×1

if-statement ×1

python ×1