Practical class-12(2021-22)
Term-1 (Practical questions-2021-2022)
Python Programming
1. Read a text file line by line and display each word separated by a #.
2.Read a text file and display the number of
vowels/consonants/uppercase/lowercase characters in the file.
*3. Remove all the lines that contain the character 'a' in a file and write
it to another file.
4. 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.
* 5. Create a binary file with roll number, name and marks. Input a roll
number and update the marks.
6. Write a random number generator that generates random numbers
between 1 and 6 (simulates a dice).
7. Create a CSV file by entering user-id and password, read and search
the password for given user-id.
8.Write a function FIBBO(n) that accept number of terms as an
argument and generates a Fibonacci series up to n terms.
9.Write a function FACT(n) to calculate factorial of a given number n.
10.WAP to find largest and smallest elements within a list.
11.WAP to input list of numbers and swap elements at the even
locations with elements at the odd location.
12. WAP to read a record from the binary file—“Student.dat”
13.Write a program to read the contents of “student.csv” file
14.Program to count the number of records present in “Student.csv”
15.program to write student data onto a csv file.
TERM-1
Unit No Marks
1: Computational thinking and programming-2 --- 35
[L-1,2,3,5 as per Sumita Arora new edition(2021-2022) Book]
(Term-1 class-XII)
PRACTICAL
1.Python program-------------------------------------------------6marks
2.Report file (Minimum-15 python programs)------------4 marks
3.Project(Using concepts of classes-11 &12)) ----------- 3 marks
synopsis of the project to be submitted by students
Documentation only
4.Viva------------------------------------------------------------------2 marks
Total=15 Marks(Practical)
Topics:
Unit I: Computational Thinking and Programming – 2
(L-1,2,3,5)
Revision of Python topics covered in Class XI.
Functions: types of function (built-in functions, functions defined in module,
user defined functions), creating user defined function, arguments and
parameters, default parameters, positional parameters, function returning
value(s), flow of execution, scope of a variable (global scope, local scope)
Introduction to files, types of files (Text file, Binary file, CSV file), relative and
absolute paths
Text file: opening a text file, text file open modes (r, r+, w, w+, a, a+), closing a
text file, opening a file using with clause, writing/appending data to a text file
using write() and writelines(), reading from a text file using read(), readline() and
readlines(), seek and tell methods, manipulation of data in a text file
Binary file: basic operations on a binary file: open using file open modes (rb, rb+,
wb, wb+, ab, ab+), close a binary file, import pickle module, dump() and load()
method, read, write/create, search, append and update operations in a binary file
CSV file: import csv module, open / close csv file, write into a csv file using
csv.writerow() and read from a csv file using csv.reader( )