EZ Tuitions Logo
EZ Tuitions
Back to Blog

Class 11 Python Chapter 5: Input, Operators and Errors

6 min read• 11/14/2026• By Ananya Sharma, Academic Content Lead, EZ Tuitions• Exam Prep

Learn Class 11 Python Chapter 5 basics with checked examples of input, type conversion, operators and errors. Original practice, not an exercise key.

A student taking notes beside a laptop at a home study desk
Key facts about this article
TopicExam Prep
FocusClass 11
Read time6 min
Words1115
Published14 Nov 2026
Best forParents & students

A Python program can run without doing what you meant. It can also stop on a line that looks reasonable at first glance. Class 11 NCERT Chapter 5, Getting Started with Python, gives you the vocabulary to work out why.

This guide concentrates on the first programs you write: names and values, operators, expressions, keyboard input, conversion and errors. It uses original examples with Python 3. It is not a complete chapter summary, a copied exercise key or a guide to later topics such as loops, user-defined functions or object-oriented design.

Interactive mode and script mode do different jobs

In interactive mode, you enter a statement or expression and see the result straight away. It is useful for a quick calculation or for checking a small idea.

In script mode, you save instructions in a file and run them together. This makes it easier to repeat a program or change several related lines.

There is a small difference worth noticing. An interactive session can display the value of an expression you type. In a script, use print() when you want a value to appear as output.

17 + 5       # A script does not print this value just because it is here.
print(17 + 5)

The printed output is:

22

Do not type the interactive prompt >>> into a script. It marks the place where an interactive interpreter is waiting for input; it is not part of your program.

A variable name refers to a value

Consider:

pages = 18
pages = pages + 4
print(pages)

The output is 22. On the second line, Python evaluates the right-hand side using the current value of pages, then assigns the result to the name on the left.

This is why = is assignment, not a mathematical statement of equality. To compare two values, use ==:

pages = 22
print(pages == 22)

This prints True.

Names are case-sensitive: pages and Pages are different identifiers. Use meaningful names, do not begin a name with a digit, and do not use a Python keyword as a variable name. A comment beginning with # can explain a choice without becoming an instruction that Python executes.

Work out operators before guessing the output

Three operators often get mixed up:

Table 1: scroll horizontally to see all columns.

Expression Result Meaning
17 / 5 3.4 Division
17 // 5 3 Floor division
17 % 5 2 Remainder

The word "floor" matters. With negative numbers, floor division does not simply chop off the decimal part:

print(-17 // 5)

The result is -4, not -3.

For mixed expressions, multiplication takes precedence over addition:

print(4 + 3 * 2)
print((4 + 3) * 2)

The outputs are 10 and 14. Parentheses make the intended grouping clear. Use them when they help a reader, even if you remember the precedence rule.

For powers, Python uses **, not ^. For example, 2 ** 3 is 8. Do not transfer symbols from handwritten mathematics into code without checking what Python means by them.

Why input needs conversion

input() returns a string. This remains true when the person at the keyboard types digits.

first = input("First number: ")
second = input("Second number: ")
print(first + second)

If the inputs are 12 and 3, the output is 123: the strings have been joined. For whole-number arithmetic, convert the inputs:

first = int(input("First whole number: "))
second = int(input("Second whole number: "))
print(first + second)

With those same inputs, this prints 15.

Use float() when your program is intended to accept a decimal value. The choice should follow the problem, not a habit of converting every input the same way.

length = float(input("Length in metres: "))
width = float(input("Width in metres: "))
print(length * width)

Inputs of 2.5 and 4 produce 10.0. These simple examples assume suitable numeric input. int("twelve") does not turn a word into a number; it raises ValueError. Handling such exceptions is outside this short introduction.

Separate syntax, runtime and logical errors

Different errors need different checks.

Table 2: scroll horizontally to see all columns.

Type Small example What went wrong
Syntax error print("Hello" A closing parenthesis is missing, so Python cannot parse the statement.
Runtime error int("twelve") The statement is valid Python, but that string cannot be converted to an integer.
Logical error Calculating a rectangle's area with length + width The program may run, but the calculation does not solve the stated problem.

For a syntax error, read the line indicated and the nearby lines. For a runtime error, inspect the operation and the values involved. For a logical error, compare the formula and output with a small case you can calculate yourself.

A useful habit is to predict the answer before pressing Run. If a rectangle is 3 metres by 4 metres, an area of 7 should make you question the formula even if Python reports no error.

Four short checks to try yourself

  1. Predict 8 + 12 // 5, then use parentheses to make a different calculation.
  2. Explain why two calls to input() followed by + can join text instead of adding numbers.
  3. Write two lines that assign a whole number to score, then increase it by 3. Print the result.
  4. Classify these problems: an unclosed quote; division by zero; a program that uses the wrong conversion formula.

For the first prompt, 12 // 5 is evaluated first, so the result is 10. For the fourth, the categories are syntax, runtime and logical error. Write your explanation before checking those answers.

Keep the chapter and syllabus scopes separate

The current NCERT Chapter 5 covers more than these examples, including an introduction to data types and mutability. A reference to Python objects in the chapter is not a reason to turn this guide into a lesson on writing classes.

CBSE's 2026-27 Computer Science syllabus places Python basics within Unit 2, Computational Thinking and Programming - I. That unit extends beyond this one chapter. A unit's marks must not be presented as marks allotted to Chapter 5.

If you need a weekly place for short coding sessions, the Class 11 school and coaching timetable example offers a worked planning approach. For individual help, you can also read about programming tutors. Neither page is a substitute for checking your own school syllabus or running your code.

Sources and edition note

All examples in this guide are original and were checked with Python 3. This guide does not claim NCERT or CBSE affiliation.

Explore related tuition services: home tuition · online tuition