Created
November 18, 2018 17:23
-
-
Save tjguk/1350262832bd0c6116cde298bfddce55 to your computer and use it in GitHub Desktop.
first.py
This file contains 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
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