lastbirthyear=float(raw_input("What was the year you had your last birthday?")) print ("") monthssinceb=float(raw_input("What is the number of months since your last birthday?")) print ("") today=float(raw_input("How many days has it been since the day your birthday? example-it has been 13 days since the 29th of the month before if today is 2/11/18 and my birthday is 9/29")) print ("") yearborn=float(raw_input("What was the year you were born?")) print ("") secyear=float((lastbirthyear-yearborn)*365.25*24.0*60.0*60.0) secmonth=float(monthssinceb*30.5*24.0*60.0*60.0) secday=float(today*24.0*60.0*60.0) secage=float((secyear+secmonth+secday)) #my last birthday was in 2017 print ("") print ("You entered that your last birthday was in " + str(lastbirthyear) + ".") print ("") #my last birthday was 5 months ago print ("You entered that your last birthday was " + str(monthssinceb) + " months ago.") print ("") #today is the 7 days away print ("You entered that today is " + str(today) + " days from your birthday day.") print ("") #I was born in 2003 print ("You entered that the year you were born is in " + str(yearborn)) print ("") print ("If that is all correct, then you should be about " + str(secage) + " seconds old.")
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question