Lesson 8: 4 corners game and "What year were you born"? - Strings & Dates

posted Dec 21, 2018, 8:00 AM by Attila Lengyel
import time, random, datetime

for j in range(0,0):
for i in range(1,11):
print(i)
time.sleep(1)
corner = random.randint(1,4)
print("If you are in corner", corner, "you are out")

today = str(datetime.date.today())
year = int(today[0] + today[1] + today[2] + today[3])
month = today[5] + today[6]
day = today[8] + today[9]
today = month + "/" + day

answer = input("Were you born before or on " + today + "?: ")
age = int(input("How old are you?: "))

if answer == "yes":
print("You were born in", year - age)
else:
print("You were born in", year - age - 1)

Comments