Patamin Aurluecha
Patamin Aurluecha

Reputation: 3

How do I apply calendar.monthcalendar function to return a matrix of days for an entire year instead of months by months manually?

How could this be done through For loops?

import calendar

print(calendar.monthcalendar(2020,1))
print(calendar.monthcalendar(2020,2))
print(calendar.monthcalendar(2020,3))
print(calendar.monthcalendar(2020,4))
print(calendar.monthcalendar(2020,5))
print(calendar.monthcalendar(2020,6))
print(calendar.monthcalendar(2020,7))
print(calendar.monthcalendar(2020,8))
print(calendar.monthcalendar(2020,9))
print(calendar.monthcalendar(2020,10))
print(calendar.monthcalendar(2020,11))
print(calendar.monthcalendar(2020,12))

I am a complete beginner here, so sorry if this question seems really dumb:(

Upvotes: 0

Views: 53

Answers (1)

mohdyel
mohdyel

Reputation: 24

import calendar

for i in range(1,13):
    print(calendar.monthcalendar(2020,i))

Upvotes: 1

Related Questions