请编写面向对象程序,实现万年历类Calendar,它可以显示用户输入的年、月的星期日历
2条回答 默认 最新
- CSDN专家-HGJ 2022-03-23 17:43关注
写一个类,调用calendar库参考如下代码:
import calendar class Calendar: def __init__(self,year,month): self.year=year self.month=month def display(self): print(calendar.month(self.year,self.month)) if __name__=='__main__': y = int(input('Input the year:')) m = int(input('Input the month:')) c=Calendar(y,m) c.display()
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 5无用