Devin Dahlberg

Python: Assignment Eight

#Date Printer
#Write a program that reads a string from the user containing a date in the form mm/dd/yyyy(EX: 03/12/2018).
#It should print the date in the format March 12, 2018

def main ():
    #Get numerical date from the user.
    user_str = input('Enter a date in the form mm/dd/yyyy: ')

    date_list = user_str.split('/')
    
    month, day, year = date_list[0], date_list[1], date_list[2]

    #Report date in Month Day, Year format.

    print(f'This date is', alpha_month(month), day,',', year,'.')


def alpha_month(month_str):

    months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December',]

    if "0" in month_str:
        month_str = month_str[1]
    month_num = int(month_str)

    return months[month_num - 1]



main()

HW8P1