Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
177 views20 pages

Term 2 XI CS Practical File 2021-22

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 20

School &

CBSE
Logo

CENTRAL BOARD OF SECONDARY EDUCATION

School Name
Address

A TERM 1 PRACTICAL RECORD FILE IS SUBMITTED TO DEPARTMENT OF COMPUTER SCIENCE FOR


THE PARTIAL FULLFILLMENT OF CLASS XI TERM 2 EXAMINATION SESSION - ________

SUBMITTED BY: [NAME OF STUDENT]


HOD(COMPUTER):[NAME OF SUBJECT TEACHER]
CLASS: [CLASS]
ROLL NO: [XXXXXXX]

TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 1


ACKNOWLEDGEMENT

I wish to express my deep sense of


gratitude and indebtedness to our learned teacher
TEACHER’S NAME , PGT COMPUTER SCIENCE,
[SCHOOL NAME] for his invaluable help, advice and
guidance in the preparation of this project.

I am also greatly indebted to our principal


[Name of principal] and school authorities for
providing me with the facilities and requisite
laboratory conditions for making this practical file.

I also extend my thanks to a number of


teachers ,my classmates and friends who helped me to
complete this practical file successfully.

[Name of Student]

TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 2


CERTIFICATE

This is to certify that [Name of Student]

, student of Class XII, [NAME OF SCHOOL] has

completed the Term I - PRACTICAL FILE during the

academic year [SESSION] towards partial fulfillment

of credit for the Computer Science practical

evaluation of CBSE and submitted satisfactory report,

as compiled in the following pages, under my

supervision.

Total number of practical certified are : 10.

External Examiner Internal Examiner


Signature Signature

Head of the Department Principal


Signature Seal and Signature
TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 3
No. Practical Date Signature
1 Write a program to find the largest number in a list.
2 Write a program to swap elements at the even location with the
elements odd location.
3 Write a program to take input a list of elements and search a
particular element.
4 Write a python program to create a tuple and print a square of each
element.
5 Write a program to accept string into tuple and extract the digits into
a new list. Print the extracted numeric list.
6 Write a program to create a dictionary with the roll number, name
and marks of n students in a class and display the names of students
who have marks above 75.
7 Write a menu-driven program to perform following operations:
1. Show record
2. Add new customer
3. Delete a customer
4. Search record
5. Update record
6. Sort record
7. Exit
8 Write a python program to find the highest 2 values in the
dictionary.
9 Write a program to choose any 4 customers randomly for lucky
winners out of 100 customers.
10 Write a menu-driven program to perform these operations by
importing string module.

TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 4


1. Write a program to find the largest number in a list.
#Variable declaration
n=int(input("Enter the number of elements:"))
l=[]
m=0

#Input from user


for i in range(n):
val=int(input("Enter element:"))
l.append(val)
print("The original list:",l)

#Finding maximum
for i in l:
if i>m:
m=i
print("The maximum number is:",m)

Output

TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 5


2. Write a program to swap elements at the even location with the

elements odd location.

#Accept the list values

l=eval(input("Enter the list:"))

#printing orioginal list

print("Original List:",l)

#Finding length and determining length for odd location

length=len(l)

if length%2!=0:

length=length-1

#Logic for swapping elements

for i in range(0,length,2):

l[i],l[i+1]=l[i+1],l[i]

#printing elements after swap

print("List after swap:",l)

TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 6


3. Input a list of elements and search a particular element.
#Accept the list values
l=eval(input("Enter the list:"))

#Ask for element to search


n=int(input("Enter element to search:"))

#Variable to check whether element found or not


f=0

#printing orioginal list


print("Original List:",l)

#Checking element is present in the list or not


for i in l:
if i==n:
f=1
break
else:
f=0

#Printing the message if element found in the list


if f==1:
print("Element found in the list")
else:
print("Element not found in the list")

TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 7


4. Write a python program to create a tuple and print a square of each

element.

#Accepting the tuple

t=eval(input("Enter elements for tuple"))

#Converting the tuples into list for manipulation

l=list(t)

#Printing original list

print("The original tuple:",t)

#traversing the list for computation

for i in range(len(l)):

l[i]=l[i]**2

#Converting list back to tuple

t=tuple(l)

#Printing the square of each element

print(t)

TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 8


5. Write a program to accept string into tuple and extract the digits into a

new list. Print the extracted numeric list.


#Accepting the tuple

t=eval(input("Enter string elements for tuple:"))

#Declaring list object for extracted elements

l=[]

#Logic to extract numbers from the given tuple

for i in t:

if i.isdigit():

l.append(i)

#CONVERTING THE STRIN INTO INTEGER

for i in range(len(l)):

l[i]=int(l[i])

#PRINTING THE FINAL EXTRACTED LIST

print(l)

TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 9


6. Write a program to create a dictionary with the roll number, name and

marks of n students in a class and display the names of students who

have marks above 75.


#Input for Number of stude
n=int(input("How many students?:"))

#Empty Dictionary
stu={}

#Data Input
for i in range(n):
print("Enter details of student:")
rn=int(input("Enter roll number:"))
name=input("Enter Name:")
marks=float(input("Enter Marks:"))
stu[rn]=[name,marks]

#Logic to display detail of students more than 75 marks


for i in stu:
if stu[i][1]>75:
print("Name:",stu[i][0],"Marks:",stu[i][1])

TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 10


7. Write a menu-driven program to perform following operations:
1. Show record
2. Add new customer
3. Delete a customer
4. Search record
5. Update record
6. Sort record
7. Exit
n=int(input("How many customers:"))
cust={}
for i in range(n):
print("Enter details of customer:",i+1)
cname=input("Enter name of customer:")
pn=int(input("Enter Phone number:"))
cust[cname]=pn
c=0
while c!=7:
print('''
1. Show record
2. Add new customer
3. Delete a customer
4. Search record
5. Update record
6. Sort record
7. Exit
''')
c=int(input("Enter your choice:"))
if c==1:
for i in cust:
print(i,":",cust[i])
elif c==2:
print("Enter details of new customer:")
cname=input("Enter name:")
pn=int(input("Enter phone number:"))
TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 11
cust[cname]=pn
elif c==3:
nm=input("Enter name to be deleted:")
f=cust.pop(nm,-1)
if f!=-1:
print(f, " is deleted successfully.")
else:
print(f, " not found.")
elif c==4:
name=input("Enter Customer Name:")
if name in cust:
print(name, " found in the record.")
else:
print(name, " not found in the record.")
elif c==5:
cname=input("Enter Customer Name:")
pn=int(input("Enter phone number to modify:"))
cust[cname]=pn
elif c==6:
l=sorted(cust)
for i in l:
print(i,":",cust[i])
elif c==7:
break

TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 12


TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 13
TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 14
TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 15
8. Write a python program to find the highest 2 values in the dictionary.
n=int(input("How many students:"))

std={}

for i in range(n):

print("Enter details of customer:",i+1)

sname=input("Enter name of student:")

per=int(input("Enter percentage:"))

std[sname]=per

s=sorted(std.values())

print("Top two values:",s[-1],s[-2])

TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 16


9. Write a menu-driven program to perform these operations by importing
string module.
import string
ch=0
while ch!=7:
print('''
1. Display the ascii letters
2. Display the digits
3. Display Hexadedigits
4. Display Octaldigits
5. Display Punctuation
6. Display string in title case
7. Exit
''')
ch=int(input("Enter your choice:"))

if ch==1:

print(string.ascii_letters)

elif ch==2:

print(string.digits)

elif ch==3:

print(string.hexdigits)

elif ch==4:

print(string.octdigits)

elif ch==5:

print(string.punctuation)

elif ch==6:

s=input("Enter sentence:")

print(string.capwords(s))

elif ch==7:

break

TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 17


TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 18
TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 19
10. Write a program to choose any 4 customers randomly for lucky winners

out of 100 customers.


import random

c1=random.randint(1,100)

c2=random.randint(1,100)

c3=random.randint(1,100)

c4=random.randint(1,100)

print("Lucky winners are:",c1,c2,c3,c4)

TERM 1 CLASS XI CS PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 20

You might also like