03.19 · Python basics / Practice · 8 min
Make the Boolean name explain the answer
True is useful only when the reader knows what is true. Replace a vague name with the question your program is answering.
Activity 19 of 19 in Python basics
Python Basics / 03.19
Name Boolean values clearly
Not started
Choose meaningful snake_case names for Boolean state and permission, then update every reference consistently.
Your lesson progress
Empty: not started. Yellow: in progress. Green: complete. Marking the whole activity complete does not replace your test results. These circles save in this browser for this pilot.

Read the name as a yes-or-no question
Names such as is_ready, has_submission and can_review suggest a state, the presence of something or a permission. Use lowercase words separated by underscores, following the snake_case style used for Python variables.
These prefixes help a person read your code; they do not change how Python evaluates it. is_ready = "yes" would still store a string. Keep Boolean state as actual True/False values or an expression that produces them.
is_ready = True
has_submission = False
can_review = is_ready and has_submission
print(can_review) # FalsePrefer a positive question and avoid double negatives
A name such as has_submission makes it clear what True means: a submission exists. A name such as is_not_missing_submission makes the same state harder to follow, especially when another not is added later.
Choose the wording that accurately describes your domain; positive names are a readability preference, not a language restriction. Avoid vague names such as flag or x when a short meaningful phrase fits.
has_submission = True
is_assigned = False
can_review = has_submission and is_assigned
print(has_submission) # True
print(can_review) # FalseRename every reference without changing the behavior
Renaming a variable means updating both its assignment and each place that reads it. If you leave the old name in an expression, Python can raise NameError. A name change alone should not change the program’s result.
In the exercise below, x means that a submission exists. Rename it to has_submission, keep is_assigned as False and update can_review to read the descriptive name. The output should stay False because the reviewer has not been assigned.
Build it one step at a time
Prefer learning by typing? Work through short instructions, run the Python code and check each change before continuing. Your guided project saves separately from the challenge below.
The mini-lesson opens in a new tab. Your own code carries forward; each step has a focused check and an optional hint.
Start mini-lesson(opens in a new tab)4 steps · Saved work · Instant feedback
YOUR TURN
Replace x with a meaningful Boolean name
Rename x to has_submission where it is assigned and where can_review reads it. Keep its Boolean value True. Keep is_assigned set to False, keep the and expression and keep print(can_review). To pass: has_submission must hold True, is_assigned must hold False, can_review must hold False, and the program must print False exactly once. This is a rename; the behavior should stay the same.
False
Keep the starting inputs. Print these lines in this order, without extra output.
- has_submission holds the Boolean True
- is_assigned still holds the Boolean False
- can_review holds the Boolean False
Edit Python, then run it. Check challenge checks your output and the listed Python requirements. Your code saves on this browser after a short pause. Sign in and choose Save account draft to keep it across devices. Word wrap is enabled.
Ready to checkRun the checks to see your results here.
Your check results
Need a nudge?
Update the assignment and the use
The old name appears on the first line and in the can_review expression. Use has_submission in both places.
A clear name should preserve the answer
A submission exists, but the reviewer is not assigned. Both conditions are required, so can_review stays False.
One possible solution
Your code may look different and still be correct. Compare the approach with your own.
has_submission tells the reader what True means, while is_assigned describes a separate state. Updating every reference preserves the result. The checks require the named values and output; they are not a full rename/refactoring analyzer. Review your source to ensure the old x name is removed.
has_submission = True
is_assigned = False
can_review = has_submission and is_assigned
print(can_review)Ready to try it?
Practice in your browser and see your results.
Progress details
Have a question?
Ask the Code Zone community.
Ask a question in The Code Zone (opens in a new tab)Continue learning

7 days freeTry The Code Zone
THE CODE ZONE COMMUNITY
Your next step is easier together.
Try the community free for 7 days.
No charge during your trial. Choose your plan on Skool.
- Ask questions and get support in the community
- Watch every course video walkthrough
- Find a study buddy in the 24/7 study room
Make the most of your trial with Premium.
Choose Premium on Skool to try Thursday live help sessions. Bring your questions, work through code, and get unstuck together.
Scheduled Thursdays in Eastern Time. Check the Skool calendar for your local date and time.
Have a website account? Sign in