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.
Guess any age
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)
print "Now we add five to your number which =", (a*2)+5
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")
jasimp 427 Senior Poster Featured Poster
Dani 4,329 The Queen of DaniWeb Administrator Featured Poster Premium Member
majestic0110 187 Nearly a Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.