Well, conceptually your code is ok. Your biggest mistake is that Christmas is (typically) December 25. Nevertheless, here are a few things you can do to make your code a bit more concise:
import time
continueLooping = True
while continueLooping:
time.sleep(60)
dateChecker = time.strftime("%b, %d", time.localtime())
if dateChecker == "Dec, 25":
print "It's Christmas"
raw_input("Enter anything to close\n")
continueLooping = False
Changes:
varthing
-> continueLooping
: You want your variable names to reflect their intended purpose.
= 1; == 1; = 0
-> = True; ; = False
: Booleans exist for a reason. They make your code more explicit and easier to read. Also, you have to write less code (== 1
).
checker
-> dateChecker
: Your variable names should be specific to their use case (just incase you need to check something else down the line)
"Dec, 24"
-> "Dec, 25"
: Again, Christmas is often December 25.
Otherwise, it's ultimately fine. The raw_input
bit doesn't seem to do much, but that's a UX thing.
Edit:
Seeing as how there's always a smaller way, I'm going to try this as succinctly as possible (without great loss to legibility).
import time
while time.strftime("%b, %d", time.localtime()) != "Dec, 25":
time.sleep(60)
print "It's Christmas"
And now I think I'm going to put this up on CodeGolf.