Skip to main content
Chapter 3 of 8
NCERT Solutions

Brief Overview of Python — NCERT Solutions

CBSE · Class 11 · Informatics Practices

NCERT Solutions for Brief Overview of Python, CBSE Class 11 Informatics Practices: 11 textbook questions solved step by step. Covers Exercise.

74 questions80 flashcards5 concepts

Interactive on Super Tutor

Studying Brief Overview of Python? Get the full interactive chapter.

Quizzes, flashcards, AI doubt-solver and a step-by-step study plan — built for NCERT solutions and more.

Free trial, no card needed.

11 Questions Solved · 1 Section

The first 6 solutions are open to read. The other 5 are free with a Super Tutor account.

Exercise

1Which of the following identifier names are invalid and why?Show solution

Invalid identifier names are:

  • a) Serial_no. — contains a dot (.), which is not allowed.
  • b) 1st_Room — starts with a digit, and an identifier cannot start with a digit.
  • c) Hundred‘∗∗—contains∗∗‘`** — contains **`, a special symbol not allowed.
  • d) Total Marks — contains a space, which is not allowed.
  • f) total-Marks — contains a hyphen (-), which is not allowed.
  • h) True — it is a keyword/reserved word, so it cannot be used as an identifier.

Valid identifiers are e) Total_Marks and g) _Percentage.

2Write the corresponding Python assignment statements:
a) Assign 10 to variable length and 20 to variable breadth.
b) Assign the average of values of variables length and breadth to a variable sum.
c) Assign a list containing strings 'Paper', 'Gel Pen', and 'Eraser' to a variable stationery.
d) Assign the strings 'Mohandas', 'Karamchand', and 'Gandhi' to variables first, middle and last.
e) Assign the concatenated value of string variables first, middle and last to variable fullname. Make sure to incorporate blank spaces appropriately between different parts of names.
Show solution

The required assignment statements are:

length = 10
breadth = 20
sum = (length + breadth) / 2
stationery = ['Paper', 'Gel Pen', 'Eraser']
first = 'Mohandas'
middle = 'Karamchand'
last = 'Gandhi'
fullname = first + ' ' + middle + ' ' + last

The blank spaces are added using ' ' so the full name is joined properly.

3Which data type will be used to represent the following data values and why?
a) Number of months in a year
b) Resident of Delhi or not
c) Mobile number
d) Pocket money
e) Volume of a sphere
f) Perimeter of a square
g) Name of the student
h) Address of the student
Show solution

The suitable data types are:

  • a) Number of months in a year — int, because it is a whole number.
  • b) Resident of Delhi or not — bool, because it has only two values: yes/no, true/false.
  • c) Mobile number — str, because it is better treated as a string of digits and may contain leading zeroes.
  • d) Pocket money — float, because it may include paise/decimal part.
  • e) Volume of a sphere — float, because it may come as a decimal value.
  • f) Perimeter of a square — float, because the side length may be fractional, so the result may also be decimal.
  • g) Name of the student — str, because it is text.
  • h) Address of the student — str, because it is text.
4Give the output of the following when num1 = 4, num2 = 3, num3 = 2
a) num1 += num2 + num3
b) print (num1)
c) num1 = num1 ** (num2 + num3)
d) print (num1)
e) num1 **= num2 + c
f) num1 = '5' + '5'
g) print(num1)
h) print(4.00/(2.0+2.0))
i) num1 = 2+9*((3*12)-8)/10
j) print(num1)
k) num1 = float(10)
l) print (num1)
m) num1 = int('3.14')
n) print (num1)
o) print(10 != 9 and 20 >= 20)
p) print(5 % 10 + 10 < 50 and 29 <= 29)
Show solution

Step by step:

  • a) num1 += num2 + num3 means num1 = num1 + (num2 + num3)
  • num2 + num3 = 3 + 2 = 5
  • num1 = 4 + 5 = 9
  • b) print(num1) prints 9.
  • c) num1 = num1 ** (num2 + num3)
  • num2 + num3 = 3 + 2 = 5
  • num1 = 9 ** 5 = 59049 if using the updated value from part (a)

But in such textbook output questions, each part is usually treated separately unless stated otherwise. Since the question says “when num1 = 4, num2 = 3, num3 = 2”, the sequence is interpreted in order. Therefore after (a), num1 is 9, so:

  • num1 = 9 ** 5 = 59049
  • d) print(num1) prints 59049.
  • e) num1 = num2 + c causes an error because c is not defined**.
  • f) num1 = '5' + '5' joins strings, so the result is '55'.
  • g) print(num1) prints 55.
  • h) print(4.00/(2.0+2.0))
  • denominator 2.0 + 2.0 = 4.0
  • 4.00 / 4.0 = 1.0
  • i) num1 = 2 + 9*((3*12)-8)/10
  • 3*12 = 36
  • 36 - 8 = 28
  • 9 * 28 = 252
  • 252 / 10 = 25.2
  • 2 + 25.2 = 27.2

So num1 becomes 27.2.

  • j) print(num1) prints 27.2.
  • k) num1 = float(10) converts to 10.0.
  • l) print(num1) prints 10.0.
  • m) num1 = int('3.14') gives an error because '3.14' is not a valid integer string.
  • n) print(num1) is not executed because the program has already stopped at the error in (m).
  • o) print(10 != 9 and 20 >= 20)
  • 10 != 9 is True
  • 20 >= 20 is True
  • True and True is True
  • p) print(5 % 10 + 10 < 50 and 29 <= 29)
  • 5 % 10 = 5
  • 5 + 10 = 15
  • 15 < 50 is True
  • 29 <= 29 is True
  • True and True is True

So the outputs/values are as listed above.

5Categorise the following as syntax error, logical error or runtime error:
a) 25 / 0
b) num1 = 25; num2 = 0; num1 / num2
Show solution
  • a) 25 / 0 — runtime error, because division by zero cannot be executed.
  • b) num1 = 25; num2 = 0; num1 / num2 — runtime error, because the division by zero occurs during execution.
6Write a Python program to calculate the amount payable if money has been lent on simple interest. Principal or money lent = P, Rate = R% per annum and Time = T years. Then Simple Interest (SI) = (P x R x T) / 100.
Amount payable = Principal + SI.
P, R and T are given as input to the program.
Show solution
# Calculate amount payable on simple interest
P = float(input("Enter principal: "))
R = float(input("Enter rate of interest: "))
T = float(input("Enter time in years: "))

SI = (P * R * T) / 100
Amount = P + SI

print("Simple Interest =", SI)
print("Amount payable =", Amount)
7Write a program to repeat the string “GOOD MORNING” n times. Here n is an integer entered by the user.

Free with a Super Tutor account

8Write a program to find the average of 3 numbers.

Free with a Super Tutor account

9Write a program that asks the user to enter one’s name and age. Print out a message addressed to the user that tells the user the year in which he/she will turn 100 years old.

Free with a Super Tutor account

10What is the difference between else and elif construct of if statement?

Free with a Super Tutor account

11Find the output of the following program segments:
a) for i in range(20, 30, 2):
print(i)
b) country = 'INDIA'
for i in country:
print (i)
c) i = 0; sum = 0
while i < 9:
if i % 4 == 0:
sum = sum + i
i = i + 2
print (sum)

Free with a Super Tutor account

5 more solved questions in Brief Overview of Python

They are free with a Super Tutor account, along with practice quizzes and flashcards for this chapter. Free to start, no card needed.

Frequently Asked Questions

What are the important topics in Brief Overview of Python for CBSE Class 11 Informatics Practices?
Key topics in Brief Overview of Python include Introduction to Python and Working with Python, Keywords, Identifiers, and Variables, Data Types, Operators and Expressions. Study these first, then practise questions on each for Class 11 exams.
Are these NCERT Solutions for Brief Overview of Python free?
The first 6 of the 11 solutions on this page are open to read. The other 5 are free with a Super Tutor account — signing up is free and needs no card.
How should I revise Brief Overview of Python for Class 11 exams?
Learn the core ideas first, then work through the 74 practice questions on Brief Overview of Python. Revise definitions regularly and use flashcards for quick recall before the exam.

Sources & Official References

Content is aligned to the official syllabus. Refer to the board website for the latest curriculum.

For serious students

Get the full Brief Overview of Python chapter — start free.

Quizzes, flashcards, an AI doubt solver and a study plan for CBSE Class 11 Informatics Practices. Free to start, no card needed.