Python arithmetic: //, % and **: Class 11 practice
In Python, / always gives a float, // is floor division (rounds down, even for negatives), % gives the remainder with the sign of the divisor, and ** is power (evaluated right to left). The quick answer and an example come first; then the method, worked examples and six graded questions.
Python arithmetic: //, % and **: quick answer
In Python, / always gives a float, // is floor division (rounds down, even for negatives), % gives the remainder with the sign of the divisor, and ** is power (evaluated right to left). Precedence: ** then * / // % then + −.
Example: What does Python print for: print(20 // 8, 20 % 8)? Answer: 2 4.
- Where it is taught: "Python Fundamentals", Class 11 Computer Science.
- On this page: the method, 3 worked examples and 6 graded questions with a full answer key.
How to use this page (about 30 minutes)
- Read the method once, then cover the worked examples and try them yourself before reading the steps.
- Do the two Basic questions without notes. If either is wrong, re-read the matching worked example.
- Do the Standard and Challenge questions, then check every line of working against the answer key — not only the final answer.
- Write down the mistake behind each wrong answer and redo that question the next day.
What you should know first
- Integer division
The idea behind python arithmetic: //, % and **
In Python, / always gives a float, // is floor division (rounds down, even for negatives), % gives the remainder with the sign of the divisor, and ** is power (evaluated right to left). Precedence: ** then * / // % then + −.
Step-by-step method
- Apply ** first (right to left).
- Then *, /, //, % left to right.
- Then + and −.
Worked example 1 (Basic)
What does Python print for: print(20 // 8, 20 % 8)?
- 20 // 8 = floor(2.5) = 2
- 20 % 8 = 20 − 8 × 2 = 4
- Answer: 2 4
Worked example 2 (Standard)
What does Python print for: print(2 ** 3 ** 2)?
- ** is right-associative: 3 ** 2 = 9
- 2 ** 9 = 512
- Answer: 512
Worked example 3 (Challenge)
What does Python print for: print(-28 // 9, -28 % 9)?
- -28 // 9 = floor(-3.11) = -4
- -28 % 9 = -28 − 9 × -4 = 8
- Answer: -4 8
Common mistakes and misconceptions
- Thinking −7 // 2 is −3 (it is −4)
- Evaluating 2 ** 3 ** 2 left to right
Practice questions
- (Basic) What does Python print for: print(22 // 8, 22 % 8)?
- (Basic) What does Python print for: print(23 // 8, 23 % 8)?
- (Standard) What does Python print for: print(2 ** 2 ** 2)?
- (Standard) What does Python print for: print(2 ** 2 ** 3)?
- (Challenge) What does Python print for: print(-27 // 6, -27 % 6)?
- (Challenge) What does Python print for: print(-53 // 8, -53 % 8)?
Answer key with full working
- Q1: 22 // 8 = floor(2.75) = 2 → 22 % 8 = 22 − 8 × 2 = 6 → Answer: 2 6
- Q2: 23 // 8 = floor(2.88) = 2 → 23 % 8 = 23 − 8 × 2 = 7 → Answer: 2 7
- Q3: ** is right-associative: 2 ** 2 = 4 → 2 ** 4 = 16 → Answer: 16
- Q4: ** is right-associative: 2 ** 3 = 8 → 2 ** 8 = 256 → Answer: 256
- Q5: -27 // 6 = floor(-4.5) = -5 → -27 % 6 = -27 − 6 × -5 = 3 → Answer: -5 3
- Q6: -53 // 8 = floor(-6.63) = -7 → -53 % 8 = -53 − 8 × -7 = 3 → Answer: -7 3
Which textbook this practice follows
This skill is taught under "Python Fundamentals" in Class 11 Computer Science. Check your own textbook's contents page — CBSE, ICSE/ISC and state boards order chapters differently.
Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.
Still stuck after the answer key?
If the same step in python arithmetic: //, % and ** keeps going wrong, a short live 1 on 1 class can find the exact gap. The first demo class is free; send the class, board and chapter on WhatsApp (+91 9379416374).
Related practice and notes
More Class 11 Computer Science practice
Continue with this syllabus
Frequently asked questions
Which chapter is python arithmetic: //, % and ** in?
This skill is taught under "Python Fundamentals" in Class 11 Computer Science. Check your own textbook's contents page — CBSE, ICSE/ISC and state boards order chapters differently.
Which question should I start with?
Start with the Basic questions. Move to Standard only when both Basic answers match the key with the same working; the Challenge questions combine this skill with earlier ones.
How were the answers checked?
Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.
Is this only for CBSE?
The skill names follow NCERT/CBSE, but the method is the same for ICSE, state boards, IGCSE and IB. Only the chapter name and order differ.
Can I get live help with this topic?
Yes. RG's E-Learning teaches live 1 on 1 online classes; the first demo class is free and fees are shared after it.