NCERT Solutions For Class 11 Science Computer Science Chapter 5 - Getting Started With Python
NCERT Solutions For Class 11 Science Computer Science Chapter 5 - Getting Started With Python
NCERT SOLUTIONS
SIGN IN
CREATE ACCOUNT
TEXTBOOK SOLUTIONS
LIVE CLASSES
NCERT Solutions
Class 11
Computer Science
Getting Started With Python
NCERT Solutions for Class 11 Science Computer science Chapter 5 Getting Started With Python are provided here with
simple step-by-step explanations. These solutions for Getting Started With Python are extremely popular among Class 11
Science students for Computer science Getting Started With Python Solutions come handy for quickly completing your
homework and preparing for exams. All questions and answers from the NCERT Book of Class 11 Science Computer
science Chapter 5 are provided here for you for free. You will also love the ad-free experience on Meritnation’s NCERT
Solutions. All NCERT Solutions for class Class 11 Science Computer science are prepared by experts and are 100%
Share
accurate.
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 1/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
Page No 115:
Question 1:
i Serial_no. v Total_Marks
ii 1st_Room vi total-Marks
iii Hundred$ vii _Percentage
iv Total Marks viii True
ANSWER:
i) Serial_no.: Invalid - Identifier in python cannot contain any special character except underscore(_).
iii) Hundred$: Invalid - Identifier in Python cannot contain any special character except underscore(_).
iv) Total Marks: Invalid - Identifier in Python cannot contain any special character except underscore(_). If more than one word is
used as a variable then it can be separated using underscore ( _ ), instead of space.
v) Total_Marks: Valid
vi) total-Marks: Invalid - Identifier in Python cannot contain any special character except underscore(_). If more than one word is
used as a variable then it can be separated using underscore ( _ ), instead of a hyphen ( - ).
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 2/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
Page No 115:
Question 2:
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.
ANSWER:
d) first,middle,last = "Mohandas","Karamchand","Gandhi"
Page No 115:
Share
Question 3:
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 3/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
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):
d) The string ‘middle’ is larger than the string ‘first’ and smaller than the string ‘last’
ANSWER:
e) len(Stationery) == 0
Page No 116:
Share
Question 4:
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 4/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
a) 0 == 1 == 2
b) 2 + 3 == 4 + 5 == 7
c) 1 < -1 == 3 > 4
ANSWER:
a) ( 0 == (1==2))
b) (2 + (3 == 4) + 5) == 7
Page No 116:
Question 5:
a) num1 = 4
num2 = num1 + 1
num1 = 2
print (num1, num2)
b) num1, num2 = 2, 6
print (num1, num2)
Share
c) num1, num2 = 2, 3
ANSWER:
a) 2, 5
b) 6, 4
c) Error as num3 is used in RHS of line 2 (num3, num2 = num1, num3 + 1) before defining it earlier.
Page No 116:
Question 6:
Which data type will be used to represent the following data values and why?
c) Mobile number
d) Pocket money
e) Volume of a sphere
f) Perimeter of a square
ANSWER:
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 6/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
a) The int data type will be used to represent 'Number of months in a year' as it will be an integer i.e. 12.
b) The boolean data type will be used to represent 'Resident of Delhi or not' as a person will be either a resident of Delhi or not a
resident of Delhi. Therefore, the values True or False will be sufficient to represent the values.
c) The integer data type will be used to represent 'Mobile number' as it will be a ten-digit integer only.
d) The float data type will be used to represent 'Pocket money' as it can be in decimal. e.g Rs. 250.50 i.e 250 rupees and 50
paise.
Volume of sphere, V=43πr3
Even if 'r' is a whole number, the value of volume can be a fraction which can be represented in a decimal form easily by float
data type.
If the side length is a decimal number, the result may come out to be a decimal number which can be easily represented by float
data type.
Note:- If the side length is a whole number, the perimeter will always be an integer, however, we should be open to the possibility
that the side length can be in decimal as well.
g) The string data type will be used to represent 'Name of the student'.
h)The string data type will be used to represent 'Address of the student'. However, if we have to store the address in a more
structured format, we can use dictionary data type as well. e.g. Address = { 'Line1': ‘Address line 1',
'Line2':'Address Line2', 'Locality':'Locality Name', 'City':'City Name', 'Pincode':110001,
'Country':'India'}
Share
Page No 116:
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 7/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
Question 7:
print (num1)
print (num1)
print(num1)
e) print(4.00/(2.0+2.0))
f) num1 = 2+9*((3*12)-8)/10
print(num1)
g) num1 = 24 // 4 // 2
print(num1)
h) num1 = float(10)
i) num1 = int('3.14')
print (num1)
j) print('Bye' == 'BYE')
Share
k) print(10 != 9 and 20 >= 20)
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 8/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
ANSWER:
a) num1 += 3 + 2
num1 = num1 + 3 + 2 = 4 + 3 + 2 = 9
num1 = 4 ** (3 + 5) = 4 ** 5 = 1024
num1 **= 5
num1 = num1 ** 5
num1 = 4 ** 5
num1 = 1024
The RHS in the above statement is '5' + '5'. Please note that 5 is enclosed in quotes and hence will be treated as a string.
Therefore, the first line is just a string concatenation which will give the output 55. The type of output will be a string, not an
integer.
e) print(4.00/(2.0 + 2.0))
Share
The numbers written in the statement are in float data type therefore, the output will be also in float data type.
print(4.00/(2.0 + 2.0))
print(4.0/4.0)
1.0
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 9/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
# The expression within outer brackets will be evaluated next
num1 = 2 + 9 * 28/10
num1 = 27.2
g) num1 = 24 // 4 // 2
#When the operators are same, left to right order will be followed for operation
num1 = 6 // 2
#When floor division is used, return value will be int data type
h) num1 = float(10)
float(10) will convert integer value to float value and therefore, the output will be 10.0.
i) num1 = int('3.14')
This will result in an error as we cannot pass string representation of float to an int function.
j) print('Bye' == 'BYE')
As Python compares string character to character and when different characters are found then their Unicode value is compared.
The character with lower Unicode value is considered to be smaller. Here, 'y' has Unicode 121 and 'Y' has 89. Therefore, the
Share
output will be 'False'.
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 10/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
print(True)
LHS:
10 + 6 * 2 ** 2 != 9//4 - 3
10 + 6 * 4 != 2 - 3
10 + 24 != -1
34 != -1
True
RHS:
29 >= 29/9
True
LHS :
5 % 10 + 10 < 50
5 + 10 < 50
15 < 50
True
RHS:
Share
29 <= 29
True
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 11/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
print(True or False)
print(True)
Page No 117:
Question 8:
a) 25 / 0
ANSWER:
a) Runtime Error. The syntax for the division is correct. The error will arise only when 'interpreter' will run this line.
b) Runtime Error. The syntax is correct. The error will arise only when 'interpreter' will run the line containing these statements.
Share
Page No 117:
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 12/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
Question 9:
A dartboard of radius 10 units and the wall it is hanging on are represented using a two-dimensional coordinate system, with the
board’s centre 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:
a) (0,0)
b) (10,10)
c) (6, 6)
d) (7,8)
ANSWER:
The distance formula can be used to calculate the distance between the points where the dart hits the dartboard and the centre
of the dartboard.
To calculate the square root, the equation can be raised to the power 0.5.
Program:
dis = (x ** 2 + y ** 2) ** 0.5
#if dis is greater than 10, means that dart is more than 10 units away from the centre.
a) (0,0): True
b) (10,10): False
c) (6,6): True
Share
d) (7,8): False
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 13/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
Page No 117:
Question 10:
Write a Python program to convert temperature in 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)
ANSWER:
Program:
boil = 100
freeze = 0
print('Water Boiling temperature in Fahrenheit::')
tb = boil * (9/5) + 32
print(tb)
tf = freeze * (9/5) + 32
print(tf)
OUTPUT:
212.0
Water Freezing temperature in Fahrenheit::
Share
32.0
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 14/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
Page No 117:
Question 11:
Write a Python program to calculate the amount 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.
ANSWER:
Program:
SI = (P * R * T)/100
amount = SI + P
print('Total amount:',amount)
OUTPUT:-
Share
Page No 118:
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 15/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
Question 12:
Write a program to calculate in how many days a work will be completed by three persons A, B and C together. A, B, C take x
days, y days and z days respectively to do the job alone. The formula to calculate the number of days if they work together is
xyz/(xy + yz + xz) days where x, y, and z are given as input to the program.
ANSWER:
Program:
#Asking for the number of days taken by A, B, C to complete the work alone
days = round(combined,2)
print('Total time taken to complete work if A, B and C work together: ', days)
OUTPUT:-
Share
Page No 118:
Question 13:
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 16/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
Write a program to enter two integers and perform all arithmetic operations on them.
ANSWER:
Program:
print("Results:-")
print("Addition: ",num1+num2)
print("Subtraction: ",num1-num2)
print("Multiplication: ",num1*num2)
print("Division: ",num1/num2)
OUTPUT:
Results:-
Addition: 11
Subtraction: 5
Multiplication: 24
Division: 2.6666666666666665
Share
Modulus: 2
Floor Division: 2
Exponentiation: 512
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 17/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
Page No 118:
Question 14:
ANSWER:
Program:
x = 5
y = 6
x = y
y = k
OUTPUT:
The values of x and y are 5 and 6 respectively.
Share
The values of x and y after swapping are 6 and 5 respectively.
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 18/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
Page No 118:
Question 15:
ANSWER:
Program:
x = 5
y = 6
x,y = y,x
OUTPUT:
Page No 118: Share
Question 16:
Write a program to repeat the string ''GOOD MORNING'' n times. Here 'n' is an integer entered by the user.
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 19/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
ANSWER:
The string will be repeated only if the value is greater than zero, otherwise, it will return a blank. Therefore, ‘if’ condition will be
used to check the values of 'n' first and then the print statement will be executed.
Program:
if n>0:
print(str * n)
else:
print("Invalid value for n, enter only positive values")
OUTPUT:
GOOD MORNING GOOD MORNING GOOD MORNING GOOD MORNING GOOD MORNING
Page No 118:
Question 17:
ANSWER:
Program:
#defining three variables
Share
a = 5
b = 6
c = 7
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 20/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
average = (a + b + c)/3
OUTPUT:
Page No 118:
Question 18:
The volume of a sphere with radius r is 4/3πr3. Write a Python program to find the volume of spheres with radius 7 cm, 12 cm, 16
cm, respectively.
ANSWER:
Program:
r1 = 7
r2 = 12
r3 = 16
#calculating the volume using the formula
volume1 = (4/3*22/7*r1**3)
volume2 = (4/3*22/7*r2**3)
volume3 = (4/3*22/7*r3**3)
Share
#printing the volume after using the round function to two decimal place for better readability
print("When the radius is",r1,"cm, the volume of the sphere will be", round(volume1,2),"cc")
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 21/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
print("When the radius is",r2,"cm, the volume of the sphere will be", round(volume2,2),"cc")
print("When the radius is",r3,"cm, the volume of the sphere will be", round(volume3,2),"cc")
OUTPUT:
When the radius is 7 cm, the volume of the sphere will be 1437.33 cc
When the radius is 12 cm, the volume of the sphere will be 7241.14 cc
When the radius is 16 cm, the volume of the sphere will be 17164.19 cc
Page No 118:
Question 19:
Write a program that asks the user to enter their name and age. Print a message addressed to the user that tells the user the
year in which they will turn 100 years old.
ANSWER:
Program:
#Program to tell the user when they will turn 100 Years old
#calculating the 100th year for the user considering 2020 as the current year
#printing the 100th year
Share
print("Hi",name,"! You will turn 100 years old in the year",hundred)
OUTPUT:
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 22/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
Hi John ! You will turn 100 years old in the year 2105
Page No 118:
Question 20:
The formula E = mc2 states that the equivalent energy (E) can be calculated as the mass (m) multiplied by the speed of light (c =
about 3×108 m/s) squared. Write a program that accepts the mass of an object and determines its energy.
ANSWER:
E = mc2
Program:
c = 3 * 10 ** 8
Energy = (mass/1000) * c ** 2
Share
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 23/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
OUTPUT:
Page No 118:
Question 21:
Presume that a ladder is put upright against a wall. Let variables length and angle store the length of the ladder and the angle
that it forms with the ground as it leans against the wall. Write a Python program to compute the height reached by the ladder on
the wall for the following values of length and angle:
ANSWER:
Share
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 24/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
Here:
To calculate the sin() value in Python, math module sin() function is needed. The values need to be passed in radians to the sin()
function. Therefore, the degree will be converted to radians and then the sin() function will be applied.
Program:
import math
length = int(input("Enter the length of the ladder: "))
radian = math.radians(degrees)
sin = math.sin(radian)
OUTPUT:
The height reached by the ladder with length 16 feet aligned at 75 degrees is 15.45 feet.
The height reached by the ladder with length 20 feet and aligned at 0 degrees is 0.0 feet.
Share
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 25/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
The height reached by the ladder with length 24 feet and aligned at 45 degrees is 16.97 feet.
The height reached by the ladder with length 24 feet and aligned at 80 degrees is 23.64 feet.
LOGIN
or
CREATE A FREE ACCOUNT
Share
NCERT SOLUTIONS RD SHARMA LAKHMIR SINGH CBSE BOARD PAPER
NCERT Solutions for Class
SOLUTIONS SOLUTIONS SOLUTIONS
12 Science RD Sharma Solutions for Lakhmir Physics Solutions CBSE Class 10 Results
Class 12 Science for Class 10
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 26/28
7/13/2021 NCERT Solutions for Class 11 Science Computer science Chapter 5 - Getting Started With Python
NCERT Solutions for Class Class 12 Science for Class 10 CBSE Class 10 Board
12 Commerce RD Sharma Solutions for Lakhmir Physics Solutions Exam Resources
NCERT Solutions for Class Class 11 Science for Class 9 CBSE Class 10 Board
12-Humanities RD Sharma Solutions for Lakhmir Chemistry Paper Solutions for Math
NCERT Solutions for Class Class 10 Solutions for Class 10 CBSE Class 10 Board
11 Science RD Sharma Solutions for Lakhmir Chemistry Paper Solutions for
NCERT Solutions for Class Class 9 Solutions for Class 9 Science
11 Commerce RD Sharma Solutions for Lakhmir Biology Solutions CBSE Class 10 Board
NCERT Solutions for Class Class 8 for Class 10 Paper Solutions for Social
11-Humanities RD Sharma Solutions for Science
HOME
ABOUT US
BLOG
TERMS & CONDITIONS
OUR RESULTS
JOBS
011-40705070
Share
https://www.meritnation.com/cbse-class-11-science/computer-science/computer-science-ncert-solution-2019/getting-started-with-python/ncert-solutions/41_71_3753_26424_115_146992 28/28