PYTHON / COMBINE BOOLEAN QUESTIONS · STEP 1 OF 4
Combine Boolean questions
Checking your account…
GUIDED PRACTICE
Combine Boolean questions
Follow the current step and use Run & check this step. Your code carries forward.
Your code stays in one editor through every step. Word wrap is enabled.
Step 1 of 4
Record two conditions
Store actual Booleans rather than quoted words.
Your task
Make the next small change, keeping the working code from the previous step.
To pass this step:
- Add
has_ticket = True. - Add
is_open = False. - Keep the earlier working code.
Press the play button labeled Run & check this step below the editor to run your code and see your check results.
Your editor is opening.
Each step builds on the last. Finish the current step before opening the next one; your code stays with you.
This is one possible solution. Compare it with your own code; opening it does not replace your work or complete a step.
# Build your program one step at a time.
has_ticket = True
is_open = False# Build your program one step at a time.
has_ticket = True
is_open = False
can_enter = has_ticket and is_open
print(can_enter)# Build your program one step at a time.
has_ticket = True
is_open = False
can_enter = has_ticket and is_open
print(can_enter)
can_prepare = has_ticket or is_open
print(can_prepare)# Build your program one step at a time.
has_ticket = True
is_open = False
can_enter = has_ticket and is_open
print(can_enter)
can_prepare = has_ticket or is_open
print(can_prepare)
is_closed = not is_open
print(is_closed)Code and completed steps save in this browser when signed out. Sign in to save across devices.
Choose the copy to continue. Your account work will only be replaced if you choose this device.
Ready to checkRun the checks to see your results here.