Professional Documents
Culture Documents
SCHOOL, NOIDA
COMPUTER SCIENCE
PRACTICAL FILE - TERM 2
Student Name:
Ayaan Sehgal
Grade: XI Einstein
Roll No:06
Session:2021-22
P a g e 1 | 12
Manav Rachna International School, Noida
Session: 2021 – 22
Certificate
This is to certify that the content of this Practical File by Ayaan Sehgal is the
bone fide work of him/her submitted to Manav Rachna International School,
Noida for consideration in partial fulfillment of the requirement of Central
Board of Secondary Education, Delhi.
The original research work was carried out by him/her under the supervision of
Ms. Ritika Singh in the academic year 2021-22. On the basis of the declaration
made by him/ her, I recommend this practical report for evaluation.
P a g e 2 | 12
Manav Rachna International School, Noida
Session: 2020 – 21
Acknowledgement
P a g e 3 | 12
Index
4 Write a program to 7
read names and
percentage
5 Write a program to 7,8
read names and
percentage
6 Write a program that 8
convert a string to a
tuple and checks the
frequency of each
element in tuple.
7 a list of words and you 8
want to sort them
according to the
number of their
characters
8 remove an element at index 3 9
and display the updated tuple.
CODE-
L=[23,3,12,8,19,54,10,67]
for i in L:
if i%2!=0:
L.remove(i)
print(L)
OUTPUT:
CODE:
a=[1,2,3,4,5,6]
b=int(input('element you want to check:'))
for i in a:
if b==i:
print('index no of selected elements:',a.index(i))
OUTPUT:
P a g e 5 | 12
Q3-Write a program to read a list of elements. Modify this list so that it
does not contain any duplicate elements.
CODE:
x = [1,2,3,4,3,2,1,4,5,6,7,7,8,9,8]
y = []
print('list before removing duplicate elements',x)
for i in x:
if i not in y:
y.append(i)
print('List after removing all duplicate elements',y)
OUTPUT:
Q
4- Write a program to read names and percentage of four students and
create a dictionary from it having names as keys. Display the dictionary.
CODE:
name=dict()
n=int(input('number of enters you want:'))
i=1
while i<=n:
a=input('Name of student:')
b=input('Percentage of student:')
name[a]=b
P a g e 6 | 12
i=i+1
print('name of student','\t','percentage of student')
for i in name:
print(i,name[i],'%')
print('in dictionary form',cname)
OUTPUT:
OUTPUT:
Q6- Write a program that convert a string to a tuple and checks the
frequency of each element in tuple.
CODE:
a='all well if it ends well'
b=tuple(a.split( ))
print(b.count('well'))
P a g e 7 | 12
OUTPUT:
Q7-Suppose you have a list of words and you want to sort them
according to the number of their characters in descending order. Write
a Python program to do the same.
CODE:
def sort(x):
x.sort(key=len,reverse=True)
return x
x=['ayaan','adi','archit','kishlay']
print(sort(x))
OUTPUT:
CODE:
= {'Ayaan':1,'adi':2}
if (len(a) == 0):
print('The Dict is empty.')
else:
print('The Dict is not empty.')
OUTPUT:
P a g e 8 | 12
Q9- Write a program to accept and store Employee name as a key and
his salary, allowance and deduction as value in a Dictionary Dict for 10
employees. Display the following Menu:
a. Display Total Salary
b. Dispay Total allowance and deductions
c. Search an employee
Create a menu-based program to perform the above-mentioned
operations.
CODE:
x=dict()
i=1
count=0
n=int(input('Enter the no. of enteries:'))
while count<=n:
a=input('name of emplyee :')
b=input('Enter Salary:')
c=input('Enter Deduction')
d=float(input('Enter the allowaance'))
e=(a,b,c)
P a g e 9 | 12
x[a]=e
count=count+1
f=x.keys()
P a g e 10 | 12
North India. Calculate the average temperature and median value. This
temperature gets dipped with a variation of 20° C in the month of
December. Write a Python program to calculate the changed median
value and average temperature.
Location Temperature
Delhi 41
Shimla 32
Chandigar 43
h
Rohtak 40
Srinagar 28
CODE:
import statistics as s
B=[41,32,43,40,28,45]
print('data OF :',B)
C=[]
for i in C:
C=C+[i -20]
P a g e 11 | 12
print ('for month of December:',int(s.mean(C)))
OUTPUT:
P a g e 12 | 12