HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Python Programming
  2. /Python Basics
  3. /Operators and Expressions

Operators and Expressions

Python Programming · Middle Stage (6–8) · 1 course, 13 worked problems, 28 practice questions

An expression is a piece of code that Python works out to give a value, such as 3 + 4 * 2. Operators are the symbols that act on values. The arithmetic operators are +, -, *, /, ** for powers, // for whole-number division and % for the remainder. Python follows the usual order of operations, so brackets come first and * comes before +. Comparison operators such as ==, < and != give True or False, and and, or and not combine them. Expressions turn formulas from science into working code.

With practice you will be able to

  • Write a physics formula as a Python expression
  • Use // and % to split a number into parts
  • Predict the value of an expression from the order of operations

On the syllabus of

  • CBSE / State Class 12
  • Python Certification
  • AP
  • IB
  • A-Level
  • IGCSE

Lessons

  • Python as a CalculatorWhy does 4 / 2 give 2.0? Why is 2 + 3 * 4 equal to 14?Middle Stage (6–8)

Practice questions

Choose an answer, then check it. Each one shows a full explanation.

One line of arithmetic, with no brackets at all, uses the remainder operator, a product, floor division and a sum. print(17 % 5 * 2 + 10 // 4) What does the program print?

Bitwise operators work on the binary digits of whole numbers. Each line below combines 6 and 3, or shifts 1, and compares the result with ==. Pick every comparison that comes out True. More than one may be right.

One or more options are correct. Tick all the correct ones: a wrong option costs marks, and a part-right answer earns part of the marks.

A program splits a four-digit number into parts with // and %. n = 4725 a = n // 100 b = n % 100 c = n // 10 % 10 print(a, b, c) What does the program print?

Seven divided by seven is worked out with / and with //. The two results are compared, and then a string and True are each tested against the number one. a = 7 / 7 b = 7 // 7 print(a == b, type(a) == type(b), "1" == 1, True == 1) What does the program print?

A program uses the bitwise operators on two small whole numbers. x = 6 y = 3 print(x & y, x | y, x ^ y, ~x, x << 1 >> 2) What does the program print?

A program does integer division and remainder on a negative number. a = -7 print(a // 2, a % 2, -a // 2) What does the program print?

A program mixes unary minus and powers. print(-2 ** 2, 2 ** 3 ** 2, (-2) ** 2) What does the program print?

A student compares text, lists and numbers with the operators <, > and ==, and wants to know which of five results are true. Which of these comparisons are true? Choose every correct option.

One or more options are correct. Tick all the correct ones: a wrong option costs marks, and a part-right answer earns part of the marks.

Which comes first, the minus or the division? What does print(20 - 6 / 2) show?

Two number tools together: what does print(abs(-8) + round(2.6)) show?

All 28 practice questions on Operators and Expressions →

Worked problems

Each one has a hint, the key idea and a full worked solution.

  • Work out each sum on paper, using the order of Python.Easy
  • A student wrote these three formulas. Each one has a mistake in the brackets…Medium
  • A number has three digits, for example 472…Medium
  • A rectangle is 12.5 m long and 4 m wide…Easy
  • What does each line show? print(7 + 2), print(7 / 2), print(7 // 2), print(7 % 2), print(7 ** 2).Easy
  • Show the quotient and the remainder when 47 is divided by 5, and check the answer.Medium
  • What do print(2 + 3 * 4 ** 2 / 8 - 1) and print((2 + 3) * 4) show?Medium
  • What is the remainder when each number is divided by 2: 14, 27 and 100? …Medium
  • Use % and // to find the last digit of 4729, and the number that is left when the last digit is…Medium
  • Asha gets 150 rupees a week. She spends 45 rupees on snacks and 30 rupees on a magazine, and saves…Easy
  • What do round(3.14159, 2), round(9.99), abs(-12) and abs(5) give?Easy
  • Change 275 seconds into minutes and seconds.Medium

All 13 worked problems on Operators and Expressions →

Python labs

  • Predict, then check
  • Quotient and remainder
  • Take a number apart
  • Round and compare
  • Project: the change maker
  • Project: seconds to a clock

Related topics

  • Python Basics
  • Getting Started with Python
  • Variables and Data Types
  • Input and Output
  • Strings
  • Conditionals: if, elif, else
  • Loops
  • Lists
  • Functions
  • Mini Projects