我试着从用户那里获取数据,然后打印这个月的日历为什么我的代码没有导出任何东西
注意我必须保留或使用def printCalender()
import calendar
def printCalender():
month=int(input("please enter month date and year hit enter after each digit is placed: "))
day=int(input())
year=int(input())
print(calendar.sunday(month,day,year))
试试这个。你所需要的只是年和月。不需要日期
输出
如果你看你的输入语句-你用错误的方式来表达它们:
你可以
month = input(int())
你应该在哪里做
month = int(input())
根据评论-->; 完成后,确保调用
printCalender()
一旦您做了这些更改,您的代码就应该可以工作了。你知道吗
据我所知,你实际上并没有运行这个函数。试试这个:
相关问题 更多 >
编程相关推荐