cs practical file
cs practical file
TER
SCIENCE
PRACTIC
AL FILE
1|Page
Practical – 1
DATE-27/5/24
Aim : 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]
Code :
Output :
2|Page
Practical – 2
DATE-27/5/24
Aim : 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]
Code :
Output :
3|Page
Practical – 3
DATE-29/5/24
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.
Code :
Output :
4|Page
Practical – 4
DATE-1/7/24
Aim : Write a Python program input n numbers in tuple
and
pass it to function to count how many even and odd
numbers are entered.
Code :
Output :
5|Page
Practical – 5
DATE-2/7/24
Aim : Write a Python program to pass a string to a
function
and count how many vowels present in the string.
Code :
Output :
6|Page
Practical – 6
DATE-6/7/24
Aim : Write a Python program to generate random
numbers
between 1 and 6 (simulates a dice) using a user
defined function
Code :
Output :
7|Page
Practical – 7
DATE-10/7/24
Aim : Write a menu driven python program to implement
10 python mathematical functions.
Code :
8|Page
9|Page
10 | P a g e
11 | P a g e
Output :
12 | P a g e
Practical – 8
DATE-18/7/24
Aim : Write a python program to implement any 05
python string functions
Code :
Output :
13 | P a g e
Practical – 9
DATE-19/7/24
Aim : Write a menu driven program in python to delete
the name of a student from the dictionary and to
search phone no of a student by student name.
Code :
14 | P a g e
Output 1 :
Output 2:
15 | P a g e
Practical – 10
DATE-25/7/24
Aim : Write a python program to read and display file
content line by line with each word separated by #.
Code :
Text File :
16 | P a g e
Output :
17 | P a g e
Practical – 11
DATE2/8/24
Aim : Write a python program Read a text file and display
the number of vowels, consonants, uppercase,
lowercase characters in the file.
Code :
Text File :
18 | P a g e
Output :
19 | P a g e
Practical – 12
DATE-6/8/24
Aim : 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.
Code :
20 | P a g e
Output :
21 | P a g e
Practical – 13
DATE-7/8/24
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.
Code :
22 | P a g e
Output :
23 | P a g e
Practical – 14
DATE-10/8/24
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.
Code :
24 | P a g e
Output :
25 | P a g e
Practical – 15
DATE-14/8/24
Aim : 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.
Code :
26 | P a g e
Output :
27 | P a g e
Practical – 16
DATE-20/8/24
Aim : Write a Menu driven program in python to count
spaces, digits, words and lines from text file TOY.txt
Code :
28 | P a g e
29 | P a g e
Output :
30 | P a g e
Practical – 17
DATE-22/8/24
Aim : Write a python program to remove all the lines that
contain the character ‘a’ in a file and write it to
another file.
Code :
Output :
31 | P a g e
Practical – 18
DATE-26/8/24
Aim : Write a Python program to function with key and
value, and update value at that key in the
dictionary entered by the user.
Code :
Output :
32 | P a g e