Last active
January 15, 2017 18:54
-
-
Save losbaltica/60085d680ed88baf91bb3ec57bd5a35c to your computer and use it in GitHub Desktop.
My first 'project' in python. Simple code to check at what year person will be 100 years old.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import date | |
name = (str(input("Enter your name: "))) | |
age = (int(input("Enter your age: "))) | |
current_year = int(date.today().year) | |
def count_age(): | |
global magic | |
if age < 100: | |
magic = str((100 - age) + current_year) | |
print("Hello %s. You can celebrate your 100 birthday in %s" % (name, magic)) | |
elif age == 100: | |
magic = str(current_year) | |
print("Hello %s. You are 100 years old now (%s)! Happy birthday!" % (name, magic)) | |
else: | |
magic = str(current_year - (age - 100)) | |
print("Hello %s. You already pass your 100 birthday in %s. Congratulation!" % (name, magic)) | |
print(count_age()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment