+ 2
What's the error
import calendar #specify the month and year year = 2024 month = 7 #create a text calendar cal = calendar.textcalendar(calendar.SUNDAY) #print the formate calendar_text = cal.formatyear(year,month) print(calendar_text)
4 Answers
+ 2
Read the error message CAREFULLY. there is no textcalendar method. check the spelling of the method
0
Tip: The method in question requires PascalCase
0
Rahul Bankar
if you only want to print the month, use prmonth.
You don't have to use print with prmonth. It prints the result by default.
https://sololearn.com/compiler-playground/cc4z2lyOaVto/?ref=app
0
There are other ways with less lines of code.
https://sololearn.com/compiler-playground/cfLiioksjb38/?ref=app
https://sololearn.com/compiler-playground/cnsTOHi7Geg1/?ref=app
https://sololearn.com/compiler-playground/cxoHjSLW6GbW/?ref=app