Skip main navigation

New offer! Get 30% off one whole year of Unlimited learning. Subscribe for just £249.99 £174.99. New subscribers only. T&Cs apply

Find out more

Finding out the precedence of logic operators

Learn algorithms, logic, and Python basics. Create simple programs, grasp computer science fundamentals, and see its impact across various fields.
Question marks, lightbulbs, tick boxes and post-it notes.

You may remember from mathematics that when you have a complicated mathematical expression, there are rules about how it should be evaluated. For example, in mathematics if you have the following expression: (2 + 3 times 5) then the result is (17) because multiplication should be evaluated before addition. That is, when the expression is evaluated you evaluate it as (3 times 5), then add (2), rather than (2 + 3), then multiply by (5).

Similarly, logic operators have an order of precedence. In this task, you need to research and find out the order of precedence of the logic operators OR, AND and NOT. You can use Google to answer this question and find resources that will explain the precedence of the logic operators. When you find the answer, write it down!

We will test your understanding in the next quiz (you can take the quiz as many times as you like – if you get it wrong, try again!).

When an expression is in brackets (parenthesis)

Note that if an expression is in parenthesis, that is the expression is surrounded by brackets then, as in maths, the expression within the parenthesis will be evaluated first.

This article is from the free online

An Introduction to Programming Using Python

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now