Created
March 26, 2013 03:40
-
-
Save PatchRowcester/5242937 to your computer and use it in GitHub Desktop.
A program to accept a number, and return True if it is odd, and False if it is even without using IF keyword
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def odd(x): | |
''' | |
x: int or float. | |
returns: True if x is odd, False otherwise | |
''' | |
# Your code here | |
y = x%2 | |
return bool(y) | |
x = int(raw_input('Enter a number: ')) | |
e = odd(x) | |
print('e = ' + str(e)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment