433,770 views
1 vote
1 vote
Write a program that reads a string from the user containing a date in the form mm/dd/yy. It should print the date in the format of March 12, 2018.

User Jacob Gorban
by
2.8k points

1 Answer

19 votes
19 votes

Answer:

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

date = input('Enter a date using the mm/dd/yyyy format ')

month, day, year = date.split('/')

month = int(month) - 1

name_of_month = months_info[month]

print(f'{name_of_month} {day}, {year}))

Step-by-step explanation:

  • Create a list of the months
  • Ask user for input in mm/dd/yyyy format and split
  • Finally, display the result
User Fustigador
by
3.7k points