from datetime import date birth_day = date(1977, 6, 9) right_now = date.today() if (right_now.month >= birth_day.month) & (right_now.day >= birth_day.day): age = right_now.year - birth_day.year else: age = right_now.year - birth_day.year - 1 if age >= 30: age = 29
-
Home
-
Meta
-
Subscribe
Pages
-
Categories
-
Archives
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006
- February 2006
- January 2006
- December 2005
- November 2005
- October 2005
- September 2005

{ 20 } Comments
Happy Birthday man.
Dream on:P
Happy b’day
Congratulations!
Merry Christmas *g*
Ohw, sorry, I mean:
Happy Birthday! May all your wishes come true!
It’s a good thing you didn’t try to use this script before this year…your age would have been off for the first half of every year!
Also, happy birthday.
Happy Birthday!
Happy Birthday!
Happy Birthday man…
Too funny. lol
Hehe, happy birthday, Aaron
@Sandy- Good call! Fixed!
Happy Birthday. Now if I can just make believe this is C++ and make it a little more realistic :).
from datetime import date
birth_day = date(1977, 6, 9)
right_now = date.today()
if (right_now.month >= birth_day.month) & (right_now.day >= birth_day.day):
age = right_now.year - birth_day.year
age = 30;
enjoy :).
Happy birthday. If you don’t like if statements–or like the elegance of modular arithmetic–there’s always:
age = age % 30
Ah, to be zero again.
I’ve probably thought about this too much… but your statement doesn’t work if
month > birthday month
and
day
Oops, I’m wasn’t escaping quoting XHTML characters.
It doesn’t work if today’s month is more than the birth month, but today’s day is less than the birth day.
Happy birthday!! You know birthdays are good for you, because the more you have, the longer you live!
happy birthday. My son wishes you a happy birthday as well
Thank you everyone! It was a good birthday. I still maintain, however, that I’m still 29.
Happy Birthday! Coincidentally, we share the same birthdate. Of course, my script must be different from yours, because I don’t have any problems claiming that I’m now 30.
Congratulations!
I also suggest dropping the bad habit of using bitwise operators (&) instead of boolean ones (and).
Post a Comment