Skip to content

Instantly share code, notes, and snippets.

@Tig10
Created June 4, 2020 14:08
Show Gist options
  • Save Tig10/3ce4d8072f04f63b1ca4c3ce8cf5ceca to your computer and use it in GitHub Desktop.
Save Tig10/3ce4d8072f04f63b1ca4c3ce8cf5ceca to your computer and use it in GitHub Desktop.
'''
Ask the user for a number. Depending on whether the number is even or odd, print
out an appropriate message to the user. Hint: how does an even/odd number react
differently when divided by 2?
Extras:
If the number is a multiple of 4, print out a different message.
Ask the user for two numbers: one number to check (call it num) and
one number to divide by (check). If check divides evenly into num, tell
that to the user. If not, print a different appropriate message.
'''
num = int(input('Enter a number: '))
check = 2
if num % check == 0:
if num % 4 == 0:
print(f'{num} is a multiple of 4.')
print(f'{num} is and even number.')
else:
print(f'{num} is and odd number.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment