This question has already been answered:

There is a code to enter the number

number = str(input('print even number ')) if int(number) in lst(): return True 

the list consists of numbers, you need to do error handling if

 type(number) != int 

but under this condition it still gives an input error.
How to solve?

Reported as a duplicate by jfs , aleksandr barakin , Alex , Denis Bubnov , user194374 on Nov 25 '16 at 19:14 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

    1 answer 1

    Wrap in try / except to handle the exception:

     number = input('print even number ') try: if int(number) in lst(): return True except ValueError: print("Введено неправильное число")