This is the code I wrote for a project in SDEV 300:
I want to point out that I am particularly fond of this piece of code because it has evolved from the first bits of code I wrote for UMGC
""" Kassandra Ring ******** 1/28/2023******* SDEV 300 """ # Program calculates how much older than Google the user is. # importing date class from datetime from datetime import date #Welcome message and request for input print ("Welcome to Nothing is Real Google Age Difference Calculator") while True: try: birthyear = input("Please enter the year you were born: ") #Calculates age of user date = date.today() age = (date.year- int(birthyear)) #Calculates age of Google google_age = (date.year- 1998) #Establish variable for difference difference = (int(age)-int(google_age)) break except ValueError: print("Please enter a number") #Prints difference between age of user and age of google. #If number is negative prints "younger" rather than older. if (age-google_age) < 0: print (("In"), (date.year), ("you are"), (difference*-1), ("years younger than Google!")) else: print (("In"), (date.year), ("you are"), (difference), ("years older than Google!"))