All this snippet does is asks you for some information and then uses it and some math to guess your age. Pretty simple but I have to start somewhere.

``````import time
a = input("How many days a week would you like to eat chocolate?  ")
b = input("Have you had your birthday yet this year(1=yes 0=no)?  ")
d = input("Enter your Date of Birth(year only) ")
if b == 1:
e = 1757
elif b == 0:
e = 1756
c = ((a*2+5)*50+e)-d
print "This is the first step. Muiltiplying your number by 2 which =", a*2
time.sleep(3)
time.sleep(3)
print "Now we mulitply your number by 50 which =", (a*2+5)*50
time.sleep(3)
print "Now we add 1757 if you have had your birthday or 1756 if you have not =", (a*2+5)*50+e
time.sleep(3)
print "Lastly we subtract your year of birth from your number which =",c
time.sleep(3)

print "If you notice your number now is split into two parts. The first part is how     many times you would like to eat chocolate a week and the second is your age."
raw_input("Hit Enter to Quit")``````

this will only work in the year of 2007 and you will have to very slightly modify it for the new year.

Dani 1,700

In PHP, the time() function gets the current system time. Perhaps there is a Python equivalent that fetches the current year according to the system time? It would be a nice next step as you learn and improve your Python.

Very nice, I don't know much about Python (at all in fact) and am trying to figure out why it won't work in this year and where it needs modifying but haven't figured it out yet. Will let you know when I do lol. I made a similar application myself when I was learning C#, these 'guess my age' programs are a good starting point for people who are new to a language. Thanks for the Snippet!