Sep-03-2017, 08:46 PM
(This post was last modified: Sep-03-2017, 08:46 PM by sparkz_alot.)
A way to test for whether a number is even or not, is to use the "%" operator.
Also, watch you indentation, Python is verity strict about it.
is_even = int(input("Enter a number: ")) if is_even % 2 == 0: print("True") else: print("False")You still need a way to keep asking the user to input an even number, if in fact, they enter 0 (zero), an odd number, or any non-integer response. Then print out the result in the required format.
Also, watch you indentation, Python is verity strict about it.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition