Getting Started with Python — NCERT Solutions
CBSE · Class 11 · Computer Science
NCERT question answers for Getting Started with Python, CBSE Class 11 Computer Science: 54 textbook questions solved step by step. Covers Exercise.
Interactive on Super Tutor
Studying Getting Started with 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.
The first 27 solutions are open to read. The other 27 are free with a Super Tutor account. Unlock all 54 free in Super Tutor
Exercise
1Which of the following identifier names are invalid and why?i Serial_no. v Total_Marks ii 1st_Room vi total-Marks iii Hundred$ vii _Percentage iv Total_Marks viii True
Show solution
| i | Serial_no. | v | Total_Marks |
|---|---|---|---|
| ii | 1st_Room | vi | total-Marks |
| iii | Hundred$ | vii | _Percentage |
| iv | Total_Marks | viii | True |
Invalid identifier names are:
- Serial_no. — contains a dot (.), which is not allowed.
- 1st_Room — begins with a digit, and an identifier cannot start with a digit.
- Hundred), which is not allowed.
- total-Marks — contains a hyphen (-), which is not allowed.
- True — it is a keyword/reserved word, so it cannot be used as an identifier.
Valid identifier names among the given ones are Total_Marks and _Percentage.
Not sure why a step works? check your working in Super Tutor
2(a)Assign 10 to variable length and 20 to variable breadth.Write the corresponding Python assignment statements:
Show solution
Write the corresponding Python assignment statements:
Use assignment statements:
length = 10
breadth = 20Not sure why a step works? check your working in Super Tutor
2(b)Assign the average of values of variables length and breadth to a variable sum.Write the corresponding Python assignment statements:
Show solution
Write the corresponding Python assignment statements:
The average of two values is their sum divided by 2.
So the assignment statement is:
sum = (length + breadth) / 2Not sure why a step works? check your working in Super Tutor
2(c)Assign a list containing strings 'Paper', 'Gel Pen', and 'Eraser' to a variable stationery.Show solution
A list is written in square brackets with items separated by commas:
stationery = ['Paper', 'Gel Pen', 'Eraser']Not sure why a step works? check your working in Super Tutor
2(d)Assign the strings 'Mohandas', 'Karamchand', and 'Gandhi' to variables first, middle and last.Write the corresponding Python assignment statements:
Show solution
Write the corresponding Python assignment statements:
Assign each string to its respective variable:
first = 'Mohandas'
middle = 'Karamchand'
last = 'Gandhi'Not sure why a step works? check your working in Super Tutor
2(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.Write the corresponding Python assignment statements:
Show solution
Write the corresponding Python assignment statements:
To join the three name parts with blank spaces, use string concatenation and add spaces in quotes:
fullname = first + ' ' + middle + ' ' + lastNot sure why a step works? check your working in Super Tutor
3(a)The sum of 20 and -10 is less than 12.Write logical expressions corresponding to the following statements in Python and evaluate the expressions (assuming variables num1, num2, num3, first, middle, last are already having meaningful values):
Show solution
Write logical expressions corresponding to the following statements in Python and evaluate the expressions (assuming variables num1, num2, num3, first, middle, last are already having meaningful values):
Write the statement as a Python logical expression:
20 + (-10) < 12Now evaluate:
- is True
So the expression evaluates to True.
Not sure why a step works? check your working in Super Tutor
3(b)num3 is not more than 24.Write logical expressions corresponding to the following statements in Python and evaluate the expressions (assuming variables num1, num2, num3, first, middle, last are already having meaningful values):
Show solution
Write logical expressions corresponding to the following statements in Python and evaluate the expressions (assuming variables num1, num2, num3, first, middle, last are already having meaningful values):
“Not more than 24” means less than or equal to 24.
So the logical expression is:
num3 <= 24Not sure why a step works? check your working in Super Tutor
3(c)6.75 is between the values of integers num1 and num2.Write logical expressions corresponding to the following statements in Python and evaluate the expressions (assuming variables num1, num2, num3, first, middle, last are already having meaningful values):
Show solution
Write logical expressions corresponding to the following statements in Python and evaluate the expressions (assuming variables num1, num2, num3, first, middle, last are already having meaningful values):
To say that 6.75 is between num1 and num2, it must be greater than one and less than the other.
A correct Python expression is:
(num1 < 6.75 and 6.75 < num2) or (num2 < 6.75 and 6.75 < num1)Not sure why a step works? check your working in Super Tutor
3(d)The string 'middle' is larger than the string 'first' and smaller than the string 'last'.Write logical expressions corresponding to the following statements in Python and evaluate the expressions (assuming variables num1, num2, num3, first, middle, last are already having meaningful values):
Show solution
Write logical expressions corresponding to the following statements in Python and evaluate the expressions (assuming variables num1, num2, num3, first, middle, last are already having meaningful values):
In Python, string comparison is done lexicographically.
So the required logical expression is:
'first' < 'middle' and 'middle' < 'last'Not sure why a step works? check your working in Super Tutor
3(e)List Stationery is empty.Show solution
A list is empty if it contains no items, but Stationery is not empty here because it refers to the list of stationery items. Therefore the statement “List Stationery is empty” is False.
Not sure why a step works? check your working in Super Tutor
4(a)Add a pair of parentheses to each expression so that it evaluates to True.0 == 1 == 2
Show solution
0 == 1 == 2
Add parentheses so that the equality is grouped first:
(0 == 1) == 2This makes the expression evaluate according to the required grouping.
Not sure why a step works? check your working in Super Tutor
4(b)Add a pair of parentheses to each expression so that it evaluates to True.2 + 3 == 4 + 5 == 7
Show solution
2 + 3 == 4 + 5 == 7
Parentheses are needed around the comparison parts so the expression groups as:
Now evaluate:
- So the comparison becomes , which is False.
To make it evaluate to True, use parentheses to compare equal values, for example:
This gives , which is True.
Not sure why a step works? check your working in Super Tutor
4(c)Add a pair of parentheses to each expression so that it evaluates to True.1 < -1 == 3 > 4
Show solution
1 < -1 == 3 > 4
The given comparison does not become True as written, because:
- is False
- is False
- is False
Using parentheses, we can group the expression as:
Now evaluate:
- → False
- → False
- So the expression becomes False == False, which is True.
Not sure why a step works? check your working in Super Tutor
5(a)Write the output of the following:num1 = 4
num2 = num1 + 1
num1 = 2
print (num1, num2)
Show solution
num1 = 4
num2 = num1 + 1
num1 = 2
print (num1, num2)
Step by step:
num1 = 4num2 = num1 + 1→num2 = 4 + 1 = 5num1 = 2→ nownum1becomes 2print(num1, num2)prints the current values ofnum1andnum2
So the output is:
2 5
Not sure why a step works? check your working in Super Tutor
5(b)Write the output of the following:num1, num2 = 2, 6
num1, num2 = num2, num1 + 2
print (num1, num2)
Show solution
num1, num2 = 2, 6
num1, num2 = num2, num1 + 2
print (num1, num2)
Step by step:
- Initially,
num1 = 2andnum2 = 6 num1, num2 = num2, num1 + 2num1gets the old value ofnum2, sonum1 = 6num2getsnum1 + 2using the oldnum1 = 2, sonum2 = 2 + 2 = 4print(num1, num2)prints6 4
So the output is:
6 4
Not sure why a step works? check your working in Super Tutor
5(c)Write the output of the following:num1, num2 = 2, 3
num3, num2 = num1, num3 + 1
print (num1, num2, num3)
Show solution
num1, num2 = 2, 3
num3, num2 = num1, num3 + 1
print (num1, num2, num3)
Step by step:
- Initially,
num1 = 2andnum2 = 3 - The statement is
num3, num2 = num1, num3 + 1 - Here,
num3on the right side is used before it has been assigned any value - So this causes an error: using an uninitialized variable
Therefore, the program does not produce a valid output. In Python, this would raise an error instead of printing a result.
Not sure why a step works? check your working in Super Tutor
6(a)Which data type will be used to represent the following data values and why?Number of months in a year
Show solution
Number of months in a year
The number of months in a year is a whole number, so the suitable data type is integer (int). It stores numeric values without a decimal part.
Not sure why a step works? check your working in Super Tutor
6(b)Which data type will be used to represent the following data values and why?Resident of Delhi or not
Show solution
Resident of Delhi or not
For resident of Delhi or not, the data has only two possible states: yes/no or true/false. So the suitable data type is Boolean (bool).
Not sure why a step works? check your working in Super Tutor
6(c)Which data type will be used to represent the following data values and why?Mobile number
Show solution
Mobile number
A mobile number is best represented as a string (str) because it is an identifier-like value and may contain leading zeros. It is not used for arithmetic.
Not sure why a step works? check your working in Super Tutor
6(d)Which data type will be used to represent the following data values and why?Pocket money
Show solution
Pocket money
Pocket money may contain decimal values, so the suitable data type is float.
Not sure why a step works? check your working in Super Tutor
6(e)Which data type will be used to represent the following data values and why?Volume of a sphere
Show solution
Volume of a sphere
The volume of a sphere is a numerical quantity that can include decimal values, so the suitable data type is float.
Not sure why a step works? check your working in Super Tutor
6(f)Which data type will be used to represent the following data values and why?Perimeter of a square
Show solution
Perimeter of a square
Perimeter of a square is a number and may be a whole number or a decimal number. So the suitable data type is float if we want to allow decimal values as well.
Not sure why a step works? check your working in Super Tutor
6(g)Which data type will be used to represent the following data values and why?Name of the student
Show solution
Name of the student
The name of the student is text data, so it should be stored as a string.
Not sure why a step works? check your working in Super Tutor
6(h)Which data type will be used to represent the following data values and why?Address of the student
Show solution
Address of the student
The address of the student is text information and may contain letters, numbers, spaces and symbols, so it should be stored as a string.
Not sure why a step works? check your working in Super Tutor
7(a)Give the output of the following when num1 = 4, num2 = 3, num3 = 2num1 += num2 + num3
print (num1)
Show solution
num1 += num2 + num3
print (num1)
Given , , .
- First calculate
- Then do , which means
- So
print(num1)displays 9.
Not sure why a step works? check your working in Super Tutor
7(b)Give the output of the following when num1 = 4, num2 = 3, num3 = 2num1 = num1 ** (num2 + num3)
print (num1)
Show solution
num1 = num1 ** (num2 + num3)
print (num1)
Given , , .
- First calculate
- Then evaluate
So the output is 1024.
Not sure why a step works? check your working in Super Tutor
num1 = '5' + '5'
print(num1)
Free with a Super Tutor account
print(4.00/(2.0+2.0))
Free with a Super Tutor account
num1 = 2+9*((3*12)-8)/10
print(num1)
Free with a Super Tutor account
num1 = 24 // 4 // 2
print(num1)
Free with a Super Tutor account
num1 = float(10)
print (num1)
Free with a Super Tutor account
num1 = int('3.14')
print (num1)
Free with a Super Tutor account
print('Bye' == 'BYE')
Free with a Super Tutor account
print(10 != 9 and 20 >= 20)
Free with a Super Tutor account
print(10 + 6 * 2 ** 2 != 9//4 -3 and 29
>= 29/9)
Free with a Super Tutor account
print(5 % 10 + 10 < 50 and 29 <= 29)
Free with a Super Tutor account
print((0 < 6) or (not(10 == 6) and
(10<0)))
Free with a Super Tutor account
error or runtime error:
25 / 0
Free with a Super Tutor account
error or runtime error:
num1 = 25; num2 = 0; num1/num2
Free with a Super Tutor account
hanging on are represented using a two-dimensional
coordinate system, with the board's center at
coordinate (0,0). Variables x and y store the
x-coordinate and the y-coordinate of a dart that
hits the dartboard. Write a Python expression using
variables x and y that evaluates to True if the dart
hits (is within) the dartboard, and then evaluate the
expression for these dart coordinates:
(0,0)
Free with a Super Tutor account
hanging on are represented using a two-dimensional
coordinate system, with the board's center at
coordinate (0,0). Variables x and y store the
x-coordinate and the y-coordinate of a dart that
hits the dartboard. Write a Python expression using
variables x and y that evaluates to True if the dart
hits (is within) the dartboard, and then evaluate the
expression for these dart coordinates:
(10,10)
Free with a Super Tutor account
degree Celsius to degree Fahrenheit. If water boils
at 100 degree C and freezes as 0 degree C, use the
program to find out what is the boiling point and
freezing point of water on the Fahrenheit scale.
(Hint: T(°F) = T(°C) × 9/5 + 32)
Free with a Super Tutor account
payable if money has been lent on simple interest.
Principal or money lent = P, Rate of interest = 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.
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
the height reached by the ladder on the wall for the following values of length and angle:
a) 16 feet and 75 degrees
b) 20 feet and 0 degrees
c) 24 feet and 45 degrees
d) 24 feet and 80 degrees
Free with a Super Tutor account
27 more solved questions in Getting Started with 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 Getting Started with Python for CBSE Class 11 Computer Science?
Are these NCERT Solutions for Getting Started with Python free?
How should I revise Getting Started with Python for Class 11 exams?
Sources & Official References
- NCERT Official — ncert.nic.in
- CBSE Academic — cbseacademic.nic.in
- CBSE Official — cbse.gov.in
- National Education Policy 2020 — education.gov.in
Content is aligned to the official syllabus. Refer to the board website for the latest curriculum.
More resources for Getting Started with Python
Practice Quiz
Test yourself with a quick quiz
Important Questions
Exam-style questions with answers
Revision Notes
Key points for last-minute revision
Formula Sheet
The chapter's formulas in one place
Chapter Summary
Understand the chapter at a glance
Concept Maps
See how topics connect
Study Plan
Step-by-step plan for this chapter
Flashcards
Quick-fire cards for active recall
Syllabus
What topics to cover
For serious students
Get the full Getting Started with Python chapter — start free.
Quizzes, flashcards, an AI doubt solver and a study plan for CBSE Class 11 Computer Science. Free to start, no card needed.