QUEEN MARY’S SCHOOL
PRACTICAL FILE
Academic Session: 2024-25
Roll No.: _______33_______
Name of Student: ____MUGDHA SINGH______
Class: XII - B
Subject: Computer Science
Subject Code: 083
Q1. Write a python program using a function to print factorial number
series from n to m numbers.
Code :-
Output:-
Q2. Write a python program to accept the username "Admin" as the default
argument and password 123 entered by the user to allow login into the
system.
Code :-
Output:-
Q3. Write a python program to demonstrate the concept of variable length
argument to calculate the product and power of the first 10 numbers.
Code :-
Output:-
Q4. Write a program using a function to find whether the given number is
palindrome or not.
Code :-
Output:-
Q5. Write a program using a function to print a Fibonacci series.
Code :-
Output:-
Q6. Create a text file "intro.txt" in python and ask the user to write a single
line of text by user input.
Code :-
Output:-
Q7. Write a program to count a total number of lines and count the total
number of lines starting with 'A', 'B', and 'C' from the file dfh.txt.
Code:-
Output:-
Q8. Write a program to replace all spaces from text with - (dash) from the
file intro.txt.
Code:-
Output:-
Q9. Write a program to know the cursor position and print the text
according to the below-given specifications:
• Print the initial position
• Move the cursor to 4th position
• Display next 5 characters
• Move the cursor to the next 10 characters
• Print the current cursor position
• Print next 10 characters from the current cursor position
Code:-
Output:-
Q10. Write a program to store customer data into a binary file cust.dat
using a dictionary and print them on screen after reading them. The
customer data contains ID as key, and name, city as values.
Code:-
Output:-
Q11. Write a program to update a record from student.dat file by its rollno.
Display the updated record on screen.
Code:-
Output:-
Q12. Write a program to write data into binary file marks.dat and display
the records of students who scored more than 95 marks.
Code:-
Output:-
Q13. Read a CSV file top5.csv and print the contents in a proper format.
The data for top5.csv file are as following:
SNo Batsman Team Runs Highest
1 K L Rahul KXI 670 132*
2 S Dhawan DC 618 106*
3 David Warner SRH 548 85*
4 Shreyas Iyer DC 519 88*
5 Ishan Kishan MI 516 99
Code:-
Output:-
Q14. Read a CSV file top5.csv and print them with tab delimiter. Ignore first
row header to print in tabular form.
Code:-
Output:-
Q15. Read a CSV file students.csv and print them with tab delimiter. Ignore
first row header to print in tabular form.
Field 1 Data Type
StudentID Integer
StudentName String
Score Integer
Code:-
Output:-
Q16. Write a program to read byte by byte from a file using seek() and tell().
Code:-
Output:-
Q17. Write a program to read and write operations on to a student.csv file having
fields roll number, name, stream and marks.
Code:-
Output:-
Q18. Write a menu driven program to calculate area of different shapes
using functions.
Code:-
Output:-
Q19. Write a menu driven program to perform basic arithmetic calculations using
functions.
Code:-
Output:-
Q20. Write a menu driven to perform basic operations on text file.
Code:-
Output:-
Q21. Write a menu driven program in python which contain student details
in binary file and should have following facilities:
1. Writing student details
2. Display all students’ details
3. Search particular student details
4. Update any student details
5. Delete any student details
6. Exit
Code:-
Output:-
Q22. Write a menu driven to perform basic operations on CSV file
Code:-
Output:-
Q23. Write a program to create a stack called country and to perform the
basic operations on it.
Code:-
Output:-
Q24. Write a program to create a stack called employee and perform the basic
operations on it.
Code:-
Output:-
Q25. Write a program to generate random number between 1 to 6.
Code:-
Output:-
Q26. Write a program to handle multiple exceptions.
Code:-
Output:-