Help on my first code: Even or Odd Machine
I've been trying to write a code in Python that tells if an integer is even or odd. I also want this code to know if the input is an integer or not, so that if the input is a string, it will say 'That is not an integer' instead of an error message. This is the code so far: a = input() #Enter your integer in the input. if int(a) % 2 == 0: print('Your integer ', a, 'is even.') elif int(a) % 2 == 1: print('Your integer', a, 'is odd.') else: print('That is not an integer.') When I enter an integer, it tells if it is even or odd. When I enter a float or string, I still get an error message. Could anyone tell me how I could rephrase the code? An explanation with it would help me learn too. Thanks! EDIT: Solved. Thanks to Toni Isotalo and Pulkit Kamboj for your help.