0

Python Code Coach: Day of the Week

Given below is my code, my logic may be completely different. So is my logic correct? My observation on this problem is given in comment of the code. Why the code isn't working? https://sololearn.com/compiler-playground/cQt7mnoI6wUA/?ref=app

26th May 2025, 4:42 AM
You
You - avatar
7 Respuestas
+ 7
You , i am not quite sure why you want to calculate all of this manually. It's not a bad idea, but due to difficult readability or other concerns it is recommended using the `datetime` module. i can see 2 issues to solve: > the input data can come in 2 different formats (as mentioned in the task description): "MM/DD/YYYY" or "Month Day, Year" so we have to handle both of these. > checking if a year is a leap year: just dividing the input year by 4 is *not sufficient*, and will lead to an issue in some cases both of these issues can be handled by using the `datetime` module.
26th May 2025, 8:20 AM
Lothar
Lothar - avatar
+ 5
You , > the mentioned `datetime` module is only available for python. in other languages there might be also libraries that can handle date values and calculation. > i remember that there is a formula for calculating this, but i am not aware of it.
26th May 2025, 8:41 AM
Lothar
Lothar - avatar
+ 4
0mi patil If I need help of chatgpt, then I would directly ask him for the problem, why you just pasted chatgpt response here?
26th May 2025, 8:02 AM
You
You - avatar
+ 3
Lothar Okay I will search for those libraries that deals with calendar. Thanks for your help
26th May 2025, 8:48 AM
You
You - avatar
+ 2
Lothar Does library to find the particular day available in all languages like python, c++, c, java, c#, ruby, swift.
26th May 2025, 8:25 AM
You
You - avatar
+ 2
Lothar Isn't there any formula by which we can directly find the day so that we can solve it in all languages with the same logic.
26th May 2025, 8:28 AM
You
You - avatar
+ 2
Zakaria Assouge , please do not post topics like yours here. > the `question&answer` forum is meant for coding related issues, questions, answers and discussions only. for this case we can use the feed from the `community section` > see also the `content creation guidelines`. https://www.sololearn.com/Content-Creation-Guidelines/
27th May 2025, 7:00 PM
Lothar
Lothar - avatar
OSZAR »