How To Make A Simple Age Program In Python

Posted: June 9, 2014 by sebastiangreening in Best of the Class of 2014
Tags: , ,
#You need an introductory sentence. So you have to use the print function. Type this below:
print("Let's see how long you have lived in days, minutes and seconds.")

#It's nice to know what the user's name is, so type this in line 2:
name = raw_input("name: ")

#You need to know the age, now you do the same thing as above except you have to use the "int" function, because the user will enter a number, like this:
print("now enter your age")
age = int(input("age: "))

#You need to do the conversions using the user's given age.
days = age * 365
minutes = age * 525948
seconds = age * 31556926

#It's time to display to the user his/her information.
print(name, "has been alive for", days,"days", minutes, "minutes and", seconds, "seconds! Yes by!")

 

Leave a comment