0
a = (input("Enter a Whole Number: "))


if type(a)== int:
    if a % 2 == 0:
        print ("Even")
    elif b % 2 != 0:
        print ("odd")
else:
    print("Invalid")

I want the output will put an invalid if the user will put a non integer. Answer if it is a odd or even if the user put an integer

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • You tagged this with a *very old and no longer supported* Python version. Are you _certain_ this is a Python 2.7 issue? – Martijn Pieters Nov 27 '22 at 15:59
  • In fact, only if you run this code with Python 3 (the current major Python version) would you experience this issue. Your code would work fine in Python 2.7. – Martijn Pieters Nov 27 '22 at 16:00

0 Answers0