Convert EUR date to US date | Sololearn: Learn to code for FREE!


Convert EUR date to US date

Why is this code wrong (in 2 cases) in code coach section? import calendar inp=input() if inp.find('/')==-1: inp=inp.replace(',','') inp=inp.split() for i in range(13): if calendar.month_name[i]==inp[0]: m=str(i) d=inp[1] y=inp[2] else: s=inp.find('/') ss=inp.rfind('/') m=inp[s+1:ss] d=inp[:s] y=inp[-(len(inp)-ss-1):] #print(len(inp)) #print(s) #print(ss) #print(m) #print(d) #print(y) print(m+'/'+d+'/'+y)

3/14/2020 10:02:10 AM

Paweł Malewicz

2 Answers

New Answer


You Program output for farmat Month dd, yyyy is giving output wrong.. Its giving like MM dd yyyy But it should like dd Mm yyyy according to description Input: November 1, 1988 Output: 1/11/1988


Yeah. You're right. I did conversion from US date to... US date ;) 2 small changes and it works. Thank you :)