Using Python for date calculations
rosuav at gmail.com
Fri Nov 21 09:40:22 CET 2014
On Fri, Nov 21, 2014 at 7:35 PM, Steve Hayes <hayesstw at telkomsa.net> wrote:
> This Python script does it for me.
> year = input("Year: ")
> age = input("Age: ")
> born = year-age
> print 'Year of birth:', born
One thing to be careful of: The input() function in Python 2 should be
avoided. Instead, use int(raw_input("Year: ")) and correspondingly
Age. It's much safer and clearer than what you have, which is an alias
for eval(raw_input("Year: ")) - very dangerous.
More information about the Python-list