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.
In [ ]:
#Main Solution without extras
def main():
if( (int(input("Enter a number"))) % 2 == 0):
print("Even number")
else:
print("Odd number")
main()
In [1]:
#Implementing Extras 1
def main():
number = get_number()
if(number % 2 == 0):
print("Even number")
if(number % 4 == 0):
print("Even number and multiple of 4")
else:
print("Odd number")
def get_number():
return int(input("Enter a number"))
main()
In [10]:
#Implementing Extras 2
def main():
number = get_number()
if(number % 2 == 0):
print("Even number")
if(number % 4 == 0):
print("Even number and multiple of 4")
else:
print("Odd number")
number2,number3= get_number() , get_number()
if (number2 % number3 == 0):
print("{} evenly devides {}".format(number2,number3))
else:
print("{} not evenly devides by {}".format(number2,number3))
def get_number():
return int(input("Enter a number"))
main()
In [ ]: