Skip to content

Instantly share code, notes, and snippets.

@azdafirmansyah
Created November 22, 2017 09:23
Show Gist options
  • Save azdafirmansyah/441537cdeaea4fe541118935a66ecc5a to your computer and use it in GitHub Desktop.
Save azdafirmansyah/441537cdeaea4fe541118935a66ecc5a to your computer and use it in GitHub Desktop.
Challange - Odd Or Even
#Ask the user for a number. Depending on whether the number is even or odd, print out an appropriate message to the user.
#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.
while True:
try:
num = int(input("Please input number : "))
check = int(input("Please input divide number :"))
if num % 4 == 0:
print("Your number multiply 4 :",num)
if num % 2 == 0:
print("Your input Even Number : ",num)
else:
print("Your input Odd Number : ",num)
if num % check == 0:
print("Divide event")
else:
print("Not divide event")
except Exception as error:
print("Please enter numeric : ", error)
finally:
print("-----------------------")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment