Answer the question
In order to leave comments, you need to log in
TypeError: '>' not supported between instances of 'int' and 'generator'?
In general, I'm trying to compare the whatsDate variable with this function cal.itermonthdays(2020, nowMonth.month)
and this error comes out: TypeError: '>' not supported between instances of 'int' and 'generator' ?
def makelistDate():
cal = calendar.Calendar()
nowMonth = datetime.datetime.now()
for whatsDate in cal.itermonthdays(2020, nowMonth.month):
print(whatsDate, end='\t')
whatsDate = int(input('\n' '...'))
if whatsDate > cal.itermonthdays(2020, nowMonth.month):
print('Правильную дату введи!')
else:
print(whatsDate)
Answer the question
In order to leave comments, you need to log in
Well, what did you want. Compare number and generator, seriously? Learn the basics, then ask questions. And I don't really understand you. If you want to check if there is a value in an iterator, then use in.
Example:
if whatsDate not in cal.itermonthdays(2020, nowMonth.month):
print('Правильную дату введи!')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question