Skip to content

Instantly share code, notes, and snippets.

@PatchRowcester
Created March 26, 2013 03:40
Show Gist options
  • Save PatchRowcester/5242937 to your computer and use it in GitHub Desktop.
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
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