Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Python None code

Practice returning None, checking for None, and distinguishing None from other false values.

Beginner ~6 min read

Challenge 1

Store None in the variable result.

python Your answer
result = 
print(result is None)

Press Ctrl⌘Enter to check your answer

Challenge 2

Call show() and print whether its result is None.

python Your answer
def show():
    print("ready")

result = show()
print(result)

Press Ctrl⌘Enter to check your answer

Challenge 3

Print 'missing' only when value is None.

python Your answer
value = None

if value:
    print("missing")

Press Ctrl⌘Enter to check your answer

Challenge 4

Print 'missing' for None but not for zero.

python Your answer
value = 0

if value:
    print("missing")

Press Ctrl⌘Enter to check your answer