""" Felix Muzny DS 2000 - lecture 2 Sept 10, 2024 a program to say how many days I've been alive """ def main(): name = input("what is your name? ") print("bday calculator for", name) # Assume: Apr. 22nd is the 111th day of the year # Assume: today is the 254th day of the year # if this year is 1992... # I lived _____ days in 1991 # and ______ days in 1992 first_year_days = (365 - 110) print("if it was 1992 this year:", first_year_days + 254) # this year is 1993... # I lived _____ days in 1991 # and ______ days in 1992 # and ______ days in 1993 print("if it was 1993 this year:", first_year_days + 365 + 254) birthyear = int(input("what year were you born? ")) # number of days in first year # plus middle years # plus days this year # plus the 8 leap days # if we don't convert the type of input() to an int... # TypeError: unsupported operand type(s) for -: 'int' and 'str' # (2024 - 1) - "1991" middle_years = ((2024 - 1) - birthyear) this_year_days = 254 leap_days = 8 total_days = first_year_days + (middle_years * 365) + this_year_days + leap_days print("total days:", total_days) # don't forget to call main()! # this should be the *only* code outside of main :) main()