Skip to content

Instantly share code, notes, and snippets.

@tjguk
Created November 18, 2018 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjguk/1350262832bd0c6116cde298bfddce55 to your computer and use it in GitHub Desktop.
Save tjguk/1350262832bd0c6116cde298bfddce55 to your computer and use it in GitHub Desktop.
first.py
name = input("Hi, what's your name?")
year = input("Hi " + name + " what year were you born in?")
month = input("What month were you born in?")
day = input("What day were you born in?")
age = 0
counter = 1
check = input("just making sure, you were born on " + day +"/"+ month +"/"+ year + " ,correct?")
if check == "yes":
print("Great!!")
else:
print("Too Bad")
import datetime
today = datetime.date.today()
tyear = (today.year)
tmonth = (today.month)
tday = (today.day)
rough_age = tyear - int(year)
if int(month) > tmonth:
age = rough_age - 1
counter = 2
if int(month) == tmonth:
if int(day) > tday:
age = rough_age - 1
counter = 2
if counter == 1:
print("you are " + str(rough_age) + " years old")
if counter == 2:
print("you are " + str(age) + " years old")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment