V
V
vanke7772021-06-10 22:31:22
Python
vanke777, 2021-06-10 22:31:22

Where is the error in the code (python?) How to fix?

vremya=input('What time is it now?')
if vremya >= 4-00 and vremya <=9-59:
print('Good morning!')
elif vremya >= 10-00 and vremya <=17-59:
print ('Good afternoon!')
elif vremya >= 18-00 and vremya <=22-00:
print('Good evening!')
else:
print('Good night!')
TypeError: '>=' not supported between instances of 'str' and 'int'
how to fix this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-06-10
@vanke777

Don't try to compare a string with a number.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question