# Brief overview of python class 11 – The comprehensive NCERT Solutions

#### Bytutorialaicsip

Oct 13, 2020

A brief overview of python class 11 – The best NCERT Solution is brought to you by us for learning in an easy and concise manner. So here we go!!!

Topics Covered

## Brief overview of python class 11

In this section of the Brief overview of python class 11, we will discuss conceptual questions from the topic.

[1] Which of the following identifier names are invalid and why?

a) Serial_no. e) Total_Marks
b) 1st_Room f) total-Marks
c) Hundred\$ g) _Percentage
d) Total Marks h) True

a) Serial_no.:Invalid, reason –> dot symbol is used which is not allowed to use in identifier names

b) 1st_Room: Invalid, reason –> Starting with a number

c) Hunderd\$: Invalid, \$ cannot be used in variable name

d) Total Marks: Invalid, space in not in identifier names

f) total-Marks: Invalid, – (dash) is not allowed

h) True: Invalid, True is a keyword

[2] Write the corresponding Python assignment statements:

a) Assign 10 to variable length and 20 to variable breadth.

``````length=10

b) Assign the average of values of variables length and breadth to a variable sum.

``sum = (length + breadth) / 2``

c) Assign a list containing strings ‘Paper’, ‘Gel Pen’, and ‘Eraser’ to variable stationery.

``stationery = ['Paper', 'Gel Pen', 'Eraser']``

d) Assign the strings ‘Mohandas’, ‘Karamchand’, and ‘Gandhi’ to variables first, middle and last.

``````first = 'Mohandas'
middle = 'Karamchand'
last = 'Gandhi'``````

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.

``fullname = first + " " + middle + " " + last``

[3] Which data type will be used to represent the following data values and why?

a) Number of months in a year – Integer Number as it is the number of months
b) Resident of Delhi or not – Boolean – True or False as only two values are there either yes or no
c) Mobile number – Integer Number, mobile doesn’t have decimal points
d) Pocket money – Float Number, it can be with fractional values
e) Volume of a sphere – Float Number can hold fractional values
f) Perimeter of a square – Float Number can hold decimal places
g) Name of the student – String, as a set of alphabets
h) Address of the student – String, Combination of letters and numbers

Below questions are based on output questions for Brief overview of python class 11.

[4] Give the output of the following when num1 = 4, num2 =3, num3 = 2

a) num1 += num2 + num3

b) print (num1)

The output is 9. This statement is having a shorthand operator +=. The execution of this statement is as following:

``````num1 = num1 + num2 + num3
num1 = 4 + 3 + 2 = 9``````

c) num1 = num1 ** (num2 + num3)
d) print (num1)

It will execute (num1 + num2) first as given in brackets, so it will be 5.

This statement contains ** operator which computes the power to the specified number. 4 ** 5 = 1024

The output will be: 1024

e) num1 **= num2 + c

It will raise an error as c is not defined. But if we take num3 in place of c, then it execute in this manner:

num1 = num1**num2+num3, so the output will be 2014.

f) num1 = ‘5’ + ‘5’

g) print(num1)

As 5 is enclosed with a single quote, so will be treated as string. So the + operator is used concatenate them. So output will be 55.

h) print(4.00/(2.0+2.0))

It will execute 2 + 2 first as given in the brackets. Then 4/4. So the final output will be 1.

i) num1 = 2+9*((3*12)-8)/10
j) print(num1)

First it will execute 3*12 = 36. Now the statement will be like this:

num1 = 2 + 9*(36-8)/10

Now it will execute 36-8 = 28. Again the statement will looks something like this:

num1 = 2 + 9*28/10

Then it will execute 28/10 = 2.8, it will look like this:

num1 = 2 + 9 * 2.8

Then it will execute 9 * 2.8 = 25.2, and finally

num1 = 2 + 25.2 = 27.2

k) num1 = float(10)
l) print (num1)

The float function returns the fractional value of the given number with decimal places. So it will be: 10.0

k) num1 = int(‘3.14’)
l) print (num1)

Error in statement. Invalid Literal as it cannot be passed string to int function. In place of int, float is required. The correct statement will be:

num1=int(float(‘3.14’))

The output will be 3.

o) print(10 != 9 and 20 >= 20)

True as condition is true.
p) print(5 % 10 + 10 < 50 and 29 <= 29)

True. As 5 % 10 + 10 = 10 < 50 and 29 <=29 – evaluates True

[5] Categorise the following as syntax error, logical error or runtime error:
a) 25 / 0
b) num1 = 25; num2 = 0; num1/num2

In both statements, ZeroDivsionError:division by zero is there. This is error is runt time error.

Watch this video :

## Brief overview of python class 11 – Programming based questions

In this section of Brief overview of python class 11 practical based programs will be discussed.

[6] Write 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.

``````p = int(input("Enter the principal amount:"))
r = float(input("Enter rate of interest:"))
t = int(input("Enter the Time duration:"))
si = (p*r*t)/100
amt_pay = p + si
print("The payable amount is:",amt_pay)``````

[7] Write a program to repeat the string ‘‘GOOD MORNING” n times. Here n is an integer entered by the user.

``````n = int(input("Enter value to repeat /'Good Morning/'"))
for i in range(n):
print("Good Morning")``````

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

``````n1,n2,n3=int(input()),int(input()),int(input())
print( (n1+n2+n3)/3)``````

[9] Write 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.

Do yourself.

The following question is knowledge based question for Brief overview of python class 11.

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

The else construct will check at the end of all statements and is the last case of if-elif-else portion, where elif checked when the top if or elif evaluates false.

Else block doesn’t require any condition, elif requires a condition.

The next questions of a Brief overview of python class 11 are based on output questions.

[11] Find the output of the following program segments:

a) for i in range(20,30,2):
print(i)

The output will be:

20
22
24
26
28

As the range is given from 20 to 30 with step value 2.

b) country = ‘INDIA’
for i in country:
print (i)

I
N
D
I
A

When the string is traversed in a loop it will print the string letter by letter.

c) i = 0; sum = 0
while i < 9:
if i % 4 == 0:
sum = sum + i
i = i + 2
print (sum)

The output is 12.

When i % 4 condition evaluates True then it will make addition of the numbers which are divisible by 4 in the range of 0 to 8. These numbers are 8 and 4. Hence the output is : 8 + 4 = 12.

## Case Study Based Question – Brief overview of python class 11

There is a case study based questions given in this Brief overview of python class 11 to develop a real time application for the input and output functions based program.

Schools use “Student Management Information System” (SMIS) to manage student-related data. This system provides facilities for:

• Recording and maintaining personal details of students.
• Maintaining marks scored in assessments and computing results of students.
• Keeping track of student attendance, and managing many other student-related data in the school.

Let us automate the same step by step.

`Identify the personal details of students from your school identity card and write a program to accept these details for all students of your school and display them in this format.`
``````studentname = input("Enter the student name:")
rno = int(input("Enter the rollno:"))
class = input("Enter the class:")
sec = input("Enter the section:")
add1 = input("Enter the address line 1:")
add2 = input("Enter the address line 2:")
city = input("Enter the city:")
pincode = input("Enter the pincode:")
contact_no = input("Enter parent's no:")
print("                        Name of School")
print("Student Name:",studentname,"\t \r Rollno:",rno)
print("Class:",class,"\t\t Section:",sec)