Skip to content

Instantly share code, notes, and snippets.

@rathankalluri
Last active November 14, 2017 04:41
Show Gist options
  • Save rathankalluri/aa885a79b97d82543c2b1894dec4f1b8 to your computer and use it in GitHub Desktop.
Save rathankalluri/aa885a79b97d82543c2b1894dec4f1b8 to your computer and use it in GitHub Desktop.
Find when you are Hundred
#!/usr/bin/python
""" The program prints when your age will be hundred """
from datetime import datetime
import sys
def year_when_hundred(current_year, age):
year = current_year.year + (100 - age)
return year
user_name = raw_input("Your Name: \n")
try:
user_age = int(input("Your Age: \n"))
except SyntaxError as e:
print("That's an error. Try again...")
sys.exit()
current_year = datetime.now()
year_at_hundered = year_when_hundred(current_year, user_age)
print(user_name + "!! You will be hundred in "+str(year_at_hundered))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment