+ 4

Code coach Day of the week

I wrote this code but it works for all test cases but one (test case #5) and I don't know why. Can you help me? Here is the problem: You receive a date and need to know what day of the week it is. Task: Create a program that takes in a string containing a date, and outputs the day of the week. Input Format: A string containing a date in either "MM/DD/YYYY" format or "Month Day, Year" format. Output Format: A string containing the day of the week from the provided date. Sample Input: 11/19/2019 Sample Output: Tuesday Here is the code I wrote: https://code.sololearn.com/cnzcUzQW582i

18th Oct 2021, 9:07 AM
Madalina Peter
Madalina Peter - avatar
2 Answers
+ 4
It works but only for some of the test cases. Some of them are with the following format: July 20, 2020 But thank you very much. It help me to imrpve my knowledge.
18th Oct 2021, 12:52 PM
Madalina Peter
Madalina Peter - avatar
+ 4
Thank you very much for your help!
18th Oct 2021, 3:37 PM
Madalina Peter
Madalina Peter - avatar