1 | P a g e
ACADEMIC YEAR: 2021-22
Name : Yugen Jarwal
Class : XII-G
Roll No. : 40
School : Kendriya Vidyalaya No.1 A.F.S Gurgaon
2 | P a g e
INDEX
S
No.
AIM Date Page
No
Sign
1 Write a python program to
search an element in a list
and display the frequency
of elements present in the
list by using a user defined
function. [List and search
element should be
entered by user]
12.6.21 6
2 Write a python program to
search an element in a list
and print the location by
using a user defined
function. [List and search
element should be
entered by user]
12.6.21 8
3 Write a python program to
pass a list to a function
and double the odd values
and half even values of a
list and display list
elements after changing.
12.6.21 10
3 | P a g e
4 Write a Python program
input n numbers in tuple
and pass it to function to
count how many even and
odd numbers are entered.
23.6.21 12
5 Write a Python program to
pass a string to a function
and count how many
vowels present in the
string.
23.6.21 14
6 Write a Python program
to generate random
numbers between 1 and 6
(simulates a dice) using a
user defined function
5.7.21 16
7 Write a menu driven
python program to
implement 10 python
mathematical functions.
5.7.21 18
8 Write a python program
to implement any 05
python string functions
5.7.21 23
9 Write a menu driven
program in python to
delete the name of a
student from the
dictionary and to search
29.7.21
25
4 | P a g e
phone no of a student by
student name.
10 Write a python program to
read and display file
content line by line with
each word separated by #.
29.7.21 28
11 Write a python program
Read a text file and display
the number of vowels,
consonants, uppercase,
lowercase characters in
the file.
15.8.21 30
12 Write a python program to
create a binary file with
name and roll number.
Search for a given roll
number and display name,
if not found display
appropriate message.
15.8.21 32
13 Write a python program
to create a CSV file by
entering user-id and
password, read and search
the password for given
user-id.
16.8.21 35
14 Write a menu driven
python program to create
25.8.21 37
5 | P a g e
a CSV file by entering
dept-id, name and city,
read and search the record
for given dept-id.
15 Write a python program to
create a dictionary with
roll number, name and
marks. Accept 5 records
from the user and write
them into a binary file.
25.8.21 39
16 Write a Menu driven
program in python to
count spaces, digits, words
and lines from text file
TOY.txt
27.8.21 41
17 Write a python program to
remove all the lines that
contain the character ‘a’ in
a file and write it to
another file.
27.8.21 44
18 Write a Python program to
function with key and
value, and update value at
that key in the dictionary
entered by the user.
27.8.21 46
6 | P a g e
Practical – 1
Aim : Write a python program to search an element in a
list and displaythe frequency of elements present in
the list by using a user defined function. [List and
search element should be entered by user]
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
7 | P a g e
Output:
8 | P a g e
Practical – 2
Aim : Write a pythonprogram to search an element in a list
and print the locationby using a user defined
function. [List and search element should be entered
by user]
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
9 | P a g e
Output:
10 | P a g e
Practical – 3
Aim : Write a python program to pass a list to a function
and double the odd values and half even values of a
list and display list elements after changing.
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
11 | P a g e
Output:
12 | P a g e
Practical – 4
Aim : Write a Python program input n numbersin tupleand
pass it to function to count how many even and odd
numbers are entered.
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
13 | P a g e
Output:
14 | P a g e
Practical – 5
Aim : Write a Python program to pass a string to a function
and count how many vowels present in the string.
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
15 | P a g e
Output:
16 | P a g e
Practical – 6
Aim : Write a Pythonprogram togenerate randomnumbers
between 1 and 6 (simulates a dice) using a user
defined function
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
17 | P a g e
Output:
18 | P a g e
Practical – 7
Aim : Write a menu driven python program to implement
10 pythonmathematical functions.
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
P.T.O
19 | P a g e
20 | P a g e
21 | P a g e
22 | P a g e
Output:
23 | P a g e
Practical – 8
Aim : Write a python program to implement any 05
python string functions
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
24 | P a g e
Output:
25 | P a g e
Practical – 9
Aim : Write a menu driven program in python to delete
the name of a student from the dictionaryand to
search phone no of a student by student name.
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
P.T.O
26 | P a g e
27 | P a g e
Output 1 :
Output 2:
28 | P a g e
Practical – 10
Aim : Write a python program to read and displayfile
content line by line with each word separated by #.
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
29 | P a g e
Text File :
Output :
30 | P a g e
Practical – 11
Aim : Write a python program Read a text file and display
the number of vowels, consonants, uppercase,
lowercase characters in the file.
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
31 | P a g e
Text File :
Output :
32 | P a g e
Practical – 12
Aim : Write a python program to create a binary file with
name and roll number. Search for a given roll
number and displayname, if not found display
appropriatemessage.
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
P.T.O
33 | P a g e
34 | P a g e
Output:
35 | P a g e
Practical – 13
Aim : Write a python program to create a CSV file by
entering user-id and password, read and search the
password for given user-id.
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
36 | P a g e
CSV file created :
Output :
37 | P a g e
Practical – 14
Aim : Write a menu driven python program to create a
CSV file by entering dept-id, name and city, read and
search the record for given dept-id.
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
38 | P a g e
CSV file created :
Output:
39 | P a g e
Practical – 15
Aim : Write a python program to create a dictionarywith
roll number, name and marks. Accept 5 records
from the user and write them into a binary file.
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
40 | P a g e
Output:
Binary File Created :
41 | P a g e
Practical – 16
Aim : Write a Menu driven program in pythonto count
spaces, digits, words and lines from text file TOY.txt
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
42 | P a g e
43 | P a g e
Output:
44 | P a g e
Practical – 17
Aim : Write a python program to remove all the lines that
containthe character ‘a’ in a file and write it to
another file.
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
45 | P a g e
Output:
46 | P a g e
Practical – 18
Aim : Write a Python program to function with key and
value, and update value at that key in the
dictionaryentered by the user.
Software Used : Pycharm (Python 3.9 64-bit)
Hardware Used: Keyboard, Monitor, Mouse, Hard disc,
RAM
Code :
47 | P a g e
Output:

Computer Science Practical File class XII

  • 1.
    1 | Pa g e ACADEMIC YEAR: 2021-22 Name : Yugen Jarwal Class : XII-G Roll No. : 40 School : Kendriya Vidyalaya No.1 A.F.S Gurgaon
  • 2.
    2 | Pa g e INDEX S No. AIM Date Page No Sign 1 Write a python program to search an element in a list and display the frequency of elements present in the list by using a user defined function. [List and search element should be entered by user] 12.6.21 6 2 Write a python program to search an element in a list and print the location by using a user defined function. [List and search element should be entered by user] 12.6.21 8 3 Write a python program to pass a list to a function and double the odd values and half even values of a list and display list elements after changing. 12.6.21 10
  • 3.
    3 | Pa g e 4 Write a Python program input n numbers in tuple and pass it to function to count how many even and odd numbers are entered. 23.6.21 12 5 Write a Python program to pass a string to a function and count how many vowels present in the string. 23.6.21 14 6 Write a Python program to generate random numbers between 1 and 6 (simulates a dice) using a user defined function 5.7.21 16 7 Write a menu driven python program to implement 10 python mathematical functions. 5.7.21 18 8 Write a python program to implement any 05 python string functions 5.7.21 23 9 Write a menu driven program in python to delete the name of a student from the dictionary and to search 29.7.21 25
  • 4.
    4 | Pa g e phone no of a student by student name. 10 Write a python program to read and display file content line by line with each word separated by #. 29.7.21 28 11 Write a python program Read a text file and display the number of vowels, consonants, uppercase, lowercase characters in the file. 15.8.21 30 12 Write a python program to create a binary file with name and roll number. Search for a given roll number and display name, if not found display appropriate message. 15.8.21 32 13 Write a python program to create a CSV file by entering user-id and password, read and search the password for given user-id. 16.8.21 35 14 Write a menu driven python program to create 25.8.21 37
  • 5.
    5 | Pa g e a CSV file by entering dept-id, name and city, read and search the record for given dept-id. 15 Write a python program to create a dictionary with roll number, name and marks. Accept 5 records from the user and write them into a binary file. 25.8.21 39 16 Write a Menu driven program in python to count spaces, digits, words and lines from text file TOY.txt 27.8.21 41 17 Write a python program to remove all the lines that contain the character ‘a’ in a file and write it to another file. 27.8.21 44 18 Write a Python program to function with key and value, and update value at that key in the dictionary entered by the user. 27.8.21 46
  • 6.
    6 | Pa g e Practical – 1 Aim : Write a python program to search an element in a list and displaythe frequency of elements present in the list by using a user defined function. [List and search element should be entered by user] Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code :
  • 7.
    7 | Pa g e Output:
  • 8.
    8 | Pa g e Practical – 2 Aim : Write a pythonprogram to search an element in a list and print the locationby using a user defined function. [List and search element should be entered by user] Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code :
  • 9.
    9 | Pa g e Output:
  • 10.
    10 | Pa g e Practical – 3 Aim : Write a python program to pass a list to a function and double the odd values and half even values of a list and display list elements after changing. Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code :
  • 11.
    11 | Pa g e Output:
  • 12.
    12 | Pa g e Practical – 4 Aim : Write a Python program input n numbersin tupleand pass it to function to count how many even and odd numbers are entered. Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code :
  • 13.
    13 | Pa g e Output:
  • 14.
    14 | Pa g e Practical – 5 Aim : Write a Python program to pass a string to a function and count how many vowels present in the string. Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code :
  • 15.
    15 | Pa g e Output:
  • 16.
    16 | Pa g e Practical – 6 Aim : Write a Pythonprogram togenerate randomnumbers between 1 and 6 (simulates a dice) using a user defined function Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code :
  • 17.
    17 | Pa g e Output:
  • 18.
    18 | Pa g e Practical – 7 Aim : Write a menu driven python program to implement 10 pythonmathematical functions. Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code : P.T.O
  • 19.
    19 | Pa g e
  • 20.
    20 | Pa g e
  • 21.
    21 | Pa g e
  • 22.
    22 | Pa g e Output:
  • 23.
    23 | Pa g e Practical – 8 Aim : Write a python program to implement any 05 python string functions Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code :
  • 24.
    24 | Pa g e Output:
  • 25.
    25 | Pa g e Practical – 9 Aim : Write a menu driven program in python to delete the name of a student from the dictionaryand to search phone no of a student by student name. Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code : P.T.O
  • 26.
    26 | Pa g e
  • 27.
    27 | Pa g e Output 1 : Output 2:
  • 28.
    28 | Pa g e Practical – 10 Aim : Write a python program to read and displayfile content line by line with each word separated by #. Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code :
  • 29.
    29 | Pa g e Text File : Output :
  • 30.
    30 | Pa g e Practical – 11 Aim : Write a python program Read a text file and display the number of vowels, consonants, uppercase, lowercase characters in the file. Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code :
  • 31.
    31 | Pa g e Text File : Output :
  • 32.
    32 | Pa g e Practical – 12 Aim : Write a python program to create a binary file with name and roll number. Search for a given roll number and displayname, if not found display appropriatemessage. Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code : P.T.O
  • 33.
    33 | Pa g e
  • 34.
    34 | Pa g e Output:
  • 35.
    35 | Pa g e Practical – 13 Aim : Write a python program to create a CSV file by entering user-id and password, read and search the password for given user-id. Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code :
  • 36.
    36 | Pa g e CSV file created : Output :
  • 37.
    37 | Pa g e Practical – 14 Aim : Write a menu driven python program to create a CSV file by entering dept-id, name and city, read and search the record for given dept-id. Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code :
  • 38.
    38 | Pa g e CSV file created : Output:
  • 39.
    39 | Pa g e Practical – 15 Aim : Write a python program to create a dictionarywith roll number, name and marks. Accept 5 records from the user and write them into a binary file. Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code :
  • 40.
    40 | Pa g e Output: Binary File Created :
  • 41.
    41 | Pa g e Practical – 16 Aim : Write a Menu driven program in pythonto count spaces, digits, words and lines from text file TOY.txt Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code :
  • 42.
    42 | Pa g e
  • 43.
    43 | Pa g e Output:
  • 44.
    44 | Pa g e Practical – 17 Aim : Write a python program to remove all the lines that containthe character ‘a’ in a file and write it to another file. Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code :
  • 45.
    45 | Pa g e Output:
  • 46.
    46 | Pa g e Practical – 18 Aim : Write a Python program to function with key and value, and update value at that key in the dictionaryentered by the user. Software Used : Pycharm (Python 3.9 64-bit) Hardware Used: Keyboard, Monitor, Mouse, Hard disc, RAM Code :
  • 47.
    47 | Pa g e Output: