Question: Part A Write a function that tests if a number is even. HINT: Recall the modulo operator %. This performs division on two numbers, but

Part A Write a function that tests if a number is even. HINT: Recall the modulo operator %. This performs division on two numbers, but instead of returning their quotient, it returns the remainder of the division. For example, 7 % 3 returns 1, since the quotient is 2 with a remainder of 1. Your function should: be named is_even take 1 argument, a number return True if the argument is even, False otherwise Make sure you're returning a boolean! Graded 1: assert is_even (3) == False Read Only 1: assert is even (123456789) == False Read Only 1: assert is_even (42) == True Read Only 1: assert is even (42.1) == False Read Only Part B How could you test if a number is odd, using your is even function from Part A? Write your answer, either using 1 line of code or explaining in only 1 sentence, in the box below. | Type Markdown and LaTeX: a
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
