Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

WGU Foundations of Programming (Python) (E010) Exam - Topic 4 Question 13 Discussion

Posted by Kanisha on Sep 27, 2026 at 11:36 PM

SIMULATION

Fix the missing return statement in this function that should return whether a number is even.

def is_even(number):

if number % 2 == 0:

True

else:

False

Suggested Answer: A

==========

Step 1: The expression number % 2 == 0 checks whether the number is even.

Step 2: The original code writes True and False, but it does not return them.

Step 3: A function must use the return statement to send a value back to the caller.

Correct code:

def is_even(number):

if number % 2 == 0:

return True

else:

return False

Simplified correct code:

def is_even(number):

return number % 2 == 0

Example:

print(is_even(4))

print(is_even(7))

Output:

True

False


Get Premium Foundations of Programming (Python) (E010) Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
4 comments · newest first
LE
Leonie 38 minutes ago
I might be confused, but I feel like the function should return the result of the condition check directly.
NA
Nada 5 days ago
I'm not entirely sure, but I think we need to return `True` and `False` directly instead of just writing them.
TR
Tran 10 days ago
Wasn't there a practice question about returning boolean values? I feel like this is similar.
IS
Isabelle 16 days ago
I think I remember that we need to use the `return` keyword to actually send back the value from the function.
0/2000 characters

Save Cancel