Last active
March 14, 2022 18:16
-
-
Save chrisy/f4bc11cd29509be22ed9304d1ad2c4c4 to your computer and use it in GitHub Desktop.
Is a number odd and divisible by 7?
This file contains 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
#!/usr/bin/env python | |
def is_odd(number): | |
if number % 2 == 0: | |
return False | |
else: | |
return True | |
def is_mul_seven(number): | |
return number % 7 == 0 | |
print("I'm looking for an odd number that is a multiple of seven.") | |
while True: | |
number = int(raw_input("Give me a number: ")) | |
if is_odd(number): | |
print("Your number is odd! W00t!") | |
if is_mul_seven(number): | |
print("Your number is also a multiple of seven! Great!") | |
break | |
else: | |
print("But it doesn't divide by seven! One more time?") | |
else: | |
print("That number isn't even vaguely odd!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment