Created
July 27, 2017 15:35
-
-
Save rostyq/d63fc32004e4180fba125e9132b4e143 to your computer and use it in GitHub Desktop.
Exercise on www.practicepython.org
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
while True: | |
try: | |
check = input("Input a natural number.\n->") | |
if check == 'exit': break | |
num = input("Input a divider.\n->") | |
if num == 'exit': break | |
check = int(check) | |
num = int(num) | |
if check % 4 == 0: | |
print("{0} is multiple of 4.".format(check)) | |
continue | |
elif num == 2: | |
if check % 2 == 0: | |
print("{0} is even.".format(check)) | |
continue | |
elif check % 2 != 0: | |
print("{0} is odd.".format(check)) | |
continue | |
elif check % num == 0: | |
print("{0} divides evenly into {1}.".format(check, num)) | |
else: | |
print("{0} does not divide evenly into {1}.".format(check, num)) | |
except: | |
print("Something went wrong. Please, try again.") | |
continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment