Skip to content

Instantly share code, notes, and snippets.

@jgarciabu
Created July 27, 2017 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgarciabu/61f3b74c0423ac0968f4c34baa850b6e to your computer and use it in GitHub Desktop.
Save jgarciabu/61f3b74c0423ac0968f4c34baa850b6e to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 27 13:09:57 2017
@author: Jeff Garcia
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("Please enter a number:\n"))
check = int(input("Please enter another number:\n"))
if check % num == 0:
print("The numbers you provided are evenly divisible by each other\n")
else:
print("The numbers you provided are not evenly divisible into each other\n")
if num % 4 == 0:
print("This number is divisible by 4\n")
elif num % 2 == 0:
print("This number is even\n")
else:
print("This number is odd\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment