Skip to content

Instantly share code, notes, and snippets.

@rostyq
Created July 27, 2017 15:35
Show Gist options
  • Save rostyq/d63fc32004e4180fba125e9132b4e143 to your computer and use it in GitHub Desktop.
Save rostyq/d63fc32004e4180fba125e9132b4e143 to your computer and use it in GitHub Desktop.
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