それは私の最後の質問に似ています。しかし、ここでは、人が次のようなことができるかどうかを知る方法を知りたいです。
joe が 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 Allowed to drive")
else:
print("Joe is allowed to drive")
drinking = True
if:
(i<= 21)
print("Joe is NOT allowed to drink.")
else:
print("Joes is allowed to drink.")