logo

Question detail

The Boolean variables `has_ticket` and `is_member` contain either True or False. Write a Python 3 Boolean expression that is True if a person has a ticket and is a member, and False otherwise. Explain why the expression works. Then state the result when `has_ticket` is True and `is_member` is False.

Try the question, check the answer, then read the explanation to understand the curriculum point.

At a glance

Question

Type

practice

Style

Topic

Programming

Exam-style question

Try this first

The Boolean variables `has_ticket` and `is_member` contain either True or False. Write a Python 3 Boolean expression that is True if a person has a ticket and is a member, and False otherwise. Explain why the expression works. Then state the result when `has_ticket` is True and `is_member` is False.

Model answer

What a good answer should say

  • The expression is `has_ticket and is_member`.
  • AND gives True only when both operands are True.
  • When `has_ticket` is True and `is_member` is False, the expression evaluates to False.

Explanation

Why this works

The required condition contains two requirements that must both be satisfied, so AND is appropriate. Because one of the values is False in the stated case, the overall result is False.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions

No questions are published for this page yet.