TheRodMeister
10/7/2018 - 3:22 AM

Checks if inputs are even or odd

second python practice problem from: https://www.practicepython.org/exercise/2014/02/05/02-odd-or-even.html

checks to see if inputs are odd, even, multiple of 4, or divides evenly or has a remainder.

input num: 10
this is an even number
this is not a multiple of 4
quotient: 10
divider: 2
they divide evenly
input num: 100
this is an even number
this is multiple of 4
quotient: 25
divider: 2
there is a remainder
input num: 
#true while loop will keep going until the base case executed
while True:
    number = input('input num: ') #take string num
    if number == 'end': #if string input is end break
        break
    else: #else convert number to int
        number = int(number)

        #checks if number is odd or even
        if number%2 == 0:
            print('this is an even number')
        else:
            print('this is an odd number')

        #Checks if number is multiple of 4
        if number%4 == 0: #check if multiple of 4 and print
            print('this is multiple of 4')
        else:
            print('this is not a multiple of 4')

    #asks user for two inputs
    userInputOne = int(input('quotient: '))
    userInputTwo = int(input('divider: '))

    #checks to see if remainder 0, if so, it is divided evenly.
    if userInputOne%userInputTwo == 0:
        print('they divide evenly')
    else: #if remainder is not 0, the two values divide oddly
        print('there is a remainder')