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
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.
+ 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?
+ 3
Lothar Okay I will search for those libraries that deals with calendar. Thanks for your help
+ 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.
+ 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/