A function needs to be defined which takes the first day of the year and the day number in the specified range (2,365) and calculates mod 7 for the sum of passed parameters.
A list containing all days is created and the result of the mod operation is passed as an index to print a day from the list.
Clear Doubts with Computer TutorIn case you’re facing problems in understanding concepts, writing programs, solving questions, want to learn fun facts | tips | tricks or absolutely anything around computer science, feel free to join CTs learner-teacher community: students.computertutor.in
First day of the year (e.g. 'Monday'): Monday
Day number: 541 Invalid
In the above code, Year is taken input and a list containing all week days is created.
The first day of the year is then taken input, and then the day number.
If the day number is in the specified range as mentioned above, the year is a valid year, or else it is prompted to be invalid.
Basic python functionality is demonstrated in above program.
To view all the lessons in chapter 1: http://computertutor.in/class-12-computer-science/chapter-1/
To view entire class 12 computer science study material: http://computertutor.in/resources/
You cannot copy content of this page