Computer Science - 4CP0 PearsonEdexcel

Operators

Overview

Every line of working code leans on a small set of operators: symbols that combine values to produce a new one. Add two prices, check whether a score beats a pass mark, decide whether both of two conditions are true at once. Get the wrong operator, or misjudge which one Python evaluates first, and a program runs without crashing while quietly producing the wrong answer.

In this lesson you will learn the six arithmetic operators, including the two that are easy to confuse (integer division and modulus), the six relational operators used to compare values, the three logical operators used to combine conditions, and the order in which Python evaluates a mixed expression. All examples are written in Python, one of the languages available for the Paper 2 practical programming exam.

Objectives

  1. Understand the purpose of, and how to use, arithmetic operators (add, subtract, divide, multiply, modulus, integer division)
  2. Understand the purpose of, and how to use, relational operators (equal to, less than, greater than, not equal to, less than or equal to, greater than or equal to)
  3. Understand the purpose of, and how to use, logic operators (AND, OR, NOT)

Lesson Note

Python provides six arithmetic operators. Four of them (add, subtract, multiply, divide) are familiar from mathematics. The other two, integer division and modulus, are specific to programming and appear constantly in Paper 2 tasks.

Available on the Green Bridge App

Download the Green Bridge CBT app on your phone or computer to access full lesson notes, practice questions, and more.

Full lesson notes with diagrams
AI-powered learning assistant
Study offline, anytime, anywhere
Available on Android, Windows, macOS, and Linux

Lesson Evaluation

Congratulations on completing the lesson on Operators. Now that youve explored the key concepts and ideas, its time to put your knowledge to the test. This section offers a variety of practice questions designed to reinforce your understanding and help you gauge your grasp of the material.

You will encounter a mix of question types, including multiple-choice questions, short answer questions, and essay questions. Each question is thoughtfully crafted to assess different aspects of your knowledge and critical thinking skills.

Use this evaluation section as an opportunity to reinforce your understanding of the topic and to identify any areas where you may need additional study. Don't be discouraged by any challenges you encounter; instead, view them as opportunities for growth and improvement.

  1. What is the value of 23 // 5 in Python? A) 3 B) 4 C) 4.6 D) 5 Answer: B
  2. What is the value of 23 % 5 in Python? A) 0 B) 3 C) 4 D) 5 Answer: B
  3. Which operator should be used to compare whether two values are equal in Python? A) = B) == C) != D) <> Answer: B
  4. In the expression 'a and b or c', which operator is applied first? A) and B) or C) They are applied in the order they are written D) It depends on the values of a, b and c Answer: A
  5. A program must only proceed if a number is greater than 0 AND less than 10. Which operator combines these two conditions? A) not B) or C) and D) % Answer: C

Available on the Green Bridge App

Download the Green Bridge CBT app on your phone or computer to access full lesson notes, practice questions, and more.

Full lesson notes with diagrams
AI-powered learning assistant
Study offline, anytime, anywhere
Available on Android, Windows, macOS, and Linux

Available on the Green Bridge App

Download the Green Bridge CBT app on your phone or computer to access full lesson notes, practice questions, and more.

Full lesson notes with diagrams
AI-powered learning assistant
Study offline, anytime, anywhere
Available on Android, Windows, macOS, and Linux

Practice Mock Questions

Want to practice mock questions on Operators? Download the Green Bridge CBT app to access mock questions and full practice assessments for this topic.

Download The App On Google Playstore

Everything you need to excel in your exams

Green Bridge CBT Mobile App
Personalized AI Learning Chat Assistant
200,000+ Past Papers Across IGCSE, JAMB, WAEC & NECO
Over 3000 Lesson Notes
Offline Support - Learn Anytime, Anywhere
Green Bridge Timetable
Literature Summaries & Potential Questions
Track Your Performance & Progress
In-depth Explanations for Comprehensive Learning