Write a program that reads a string from the user containing a date in the forma
ID: 3770294 • Letter: W
Question
Write a program that reads a string from the user containing a date in the format ( mm/dd/yyyy. ) You program should print the date in the form: November 17,2011.
Additional Program requirements:
You are to define and use a list of month names to convert month number input to string name. i.e.
month_list = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
I recommend that you use the split method on the input date string to create a list of numbers between / marks. i.e.
#split date_string
date_list = date_string.split("/")
Please use this with python and type the layout as if you were editing with idle on python
Explanation / Answer
month_list = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
date_string = str(input())
date_list = date_string.split("/")
print month_list[int(date_list[0])-1],
print " "+date_list[1]+",",
print date_list[2]
--------------------------------------------
Input : "11/17/2011"
output : November 17, 2011
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.