Computer Science Practical File
Name- Shray Mittal
Class- XII A
Roll No.- 7
Submitted To- Ms. Harpreet Kaur
Q1 WAP to compute x^n of given two
integers x and n.
Q2 WAP to print Fibonacci series up to
certain limit using user-defined module.
Q3 Write a Program to find factorial of entered
number using user-defined module fact()
Q4 WAP to accept a number, find and display
whether it’s a Armstrong number or not
.
Q5) WAP to accept a number and find out
whether it is a perfect number or not.
Q6) WAP to print the following pattern:
1
12
123
1234
12345
Q7) WAP that counts the number of alphabets and
digits, uppercase letters, lowercase letter, spaces
and other characters in the string entered.
Q8) WAP to accept a string ( a sentence) and returns a
string having first letter of each word in capital letter.
Q9 WAP to remove all odd numbers from the given
Index list.
Q10) WAP to display cumulative elements of a given
list.
.
Q11) WAP to display frequencies of all the elements
of a list.
Q12) WAP to create a CSV file to store student
data(Rollno, Name, Marks). Obtain data from user and
write 5 records into file
.
Q13) Write a function in Python to count the number of
lines in a text file “STORY.TXT” which is starting with an
alphabet ‘A’.
Q14) Write a function that reads a text file and prints only
the numbers or digits from the file.
Q15) Write a function that copies a text file source.txt
onto target.txt barring the lines starting with ‘a’.
Q16) A binary file “Book.dat” has structure [bookno,Book_name, Author, Price]. Write a menu driven program. a. To
write a function CreateFile() to input data and add in Book.dat. b. To write a function CountRec(Author) in python
which accepts the Author name as parameter and count and return the number of books by th given Author c. To
write a function to update the price of book having bookno passed as parameter Update(bookno).
Q17) A csv file teacher.csv contains details (Teacherid, Teachername,
subjecttaught and salary) and write a menu driven python program
a. To take input from user and add records in csv file.
b. To update salary of teacher.
Q18) Write a menu based program to Maintaining Book details
like bcode, btitle and price using stacks in python. Write functions
to perform push, pop and display methods.
Q19) Write a menu based program to add, delete and display the record of
hostel using list as stack data structure in python. Record of hostel
contains the fields :Hostel number, Total Students and Total Rooms.