logo

AQA A-Level Computer Science practice

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 first, then check the answer and practise the same topic again.

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.

Answer and explanation

Concise answer

The expression is `has_ticket and is_member`.

Why this is correct

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.

Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions