Practical file
Practical file
CHILDREN ACADEMY,
RAJ NAGAR Extension, GZB
Practical file on
Computer science (083)
Session: 2024-2025
Index
Write a program that performs the following operations on a string:
(a)Prompt the user to input a string.
(b) Extract all the digits from the string.
(c) If there are digits in the inputted string:
Calculate and display the sum of the digits.
Also display:
The original string
The sum of the digits
Input:
Output:
Write a program with a user-defined function with string as a
parameter which replaces all vowels in the string with “*”
Input:
Output:
Write a python program to remove duplicates from a
list.
A = [10, 20, 30, 20, 10, 50, 60, 40, 80, 50, 40]
Input:
Output:
Write a Python program that generates random
numbers between 1 and 6 (simulates a dice)
Input:
Output:
Write a program that defines a function which will print
Fibonacci series till n passed as argument to the
function.
Input:
Output:
Write a Python program that defines a method to find and
display the prime numbers between 2 to N. Pass N as argument
to the method.
Input:
Output:
Remove all the lines that contain the character `a' in a file and
write it to another file.
Input:
Output:
Write a Python program to print just the last line of a text file
"data.txt" along with total lines in a test file
Input:
Text File:
Output:
Write a menu-driven program implementing user-defined functions to
perform different operations onto a student.csv file having fields roll
number, name, stream and marks such as:
(b) Write all the records in one single go onto the CSV.
Input:
Output:
Write a Python program that create a binary file with roll
number, name and marks. Input a roll number and update the
marks
Input:
Output:
Write a program to add (PUSH), delete (POP) and display the
records using list through Stack.
Input:
Output:
Write a program to display unique vowels present in the given
word using stack
Input:
Output:
Write a Python program that prints the first n rows of Pascal's
triangle.
Input:
Output:
Write a Python program that read a text file line by line and
display each word separated by a #.
Input:
Text File:
Output:
Write a Python program that read a text file and display the
number of (a) vowels (b) consonants (c) uppercase (d)
lowercase characters in the file.
Input:
Text File:
Output:
Write a Python program that create a binary file with name and
roll number. Search for a given roll number and display the
name, if not found display appropriate message
Input:
Output: