How to pass all the test case...! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to pass all the test case...!

Create a function that takes in a string containing a date that is in US format, and return a string of the same date converted to EU. Input Format: A string that contains a date formatting 11/19/2019 or November 19, 2019. Output Format: A string of the same date but in a different format: 19/11/2019. user= input() data= user.split("/") data[0],data[1]=data[1],data[0] u="/" print(u.join(data))

15th Jun 2022, 2:28 PM
Mihir Lalwani
Mihir Lalwani - avatar
3 Answers
+ 3
I think your code is great, but it also needs to work for month names like January, February etc. according to the prompt. Try making a list of month names and converting them to numbers at the beginning of your code. I hope this helps.
15th Jun 2022, 2:52 PM
madeline
madeline - avatar
+ 3
madeline okay i will try this sol too
16th Jun 2022, 7:27 AM
Mihir Lalwani
Mihir Lalwani - avatar
+ 1
Good to hear Mihir, you could also use a dictionary to store the month names and numbers. There are many ways to solve the problems. Good luck!
16th Jun 2022, 2:51 PM
madeline
madeline - avatar