Computer Science, asked by malviyavrishank, 1 year ago

8. Write a program that reads a date as an integer in the format MMDDYYYY. The program will call a
function that prints print out the date in the format Month Name> <days, syear,

Sample run:
Enter date : 12252019
December 25, 2019​

Answers

Answered by fiercespartan
31

Here is how you do it... It is pretty self explanatory

CODE:

months = {01:'January',02:'February',03:'March',04:'April',05:'May',06:'June',07:'July',08:'August',09:'september',10:'october',11:'November',12:'December'}

format = str(input('Input your date:'))

month,date,year = months[format[:2]],format[2:4],format[4:8]

print(f'{month} {date}, {year}')

___________________________________

Answered by vikram499kumar
8

Answer:

MONTHS = ['January', 'February', 'Match', 'April', 'May', 'June',

     'July', 'August', 'September', 'October', 'November', 'December']

def date_convert(s):

   y = s[:4]

   m = int(s[5:-3])

   d = s[8:]

   month_name = MONTHS[m-1]

   result= month_name + ' ' + d + ' '  + y

   return result

s = '2019/06/06'

r = date_convert(s)

print(r)

Explanation:

output

June 06 2019

Similar questions