SAHIL RAJPUT Mr. MOHD ASLAM Class 12-A (PGT Computer Science) Roll no.: INDEX S Name of Practical Page Date Sign. No. no. 1 Read a text file line by line and display 1 each word separated by a 2 Read a text file and display the number of 2 vowels/consonants/uppercase/lowercase characters in the file. 3 Remove all the lines that contain the 3 character 'a' in a file and write it to another file. 4 Create a binary file with name and roll 4 number. Search for a given roll numberand display the name, if not found display appropriate message. 5 Create a binary file with roll number, name 6 and marks. Input a roll number and update the marks. 6 Write a random number generator that 8 generates random numbers between 1 and 6 (simulates a dice). 7 Write a Python program to implement a 9 stack using list. 8 11 Create a CSV file by entering user-id and password, read and search the password for given user-id 9 Take a sample of ten phishing e-mails (or any 13 text file) and find most commonly occurring word(s)
10 Write a program to display unique 14
vowels present in the given word using Stack.
11 Write a program that appends the contents of 15
one file to another and takes the filename of the new file from the user. 12 Write a program to read specific columns 16 from a 'department.csv' file and print the content of the columns, department ID and department name 13 Write user defined functions to read and 17 write operations onto a'student.csv' file having fields: roll number, name, stream and marks. 14 Write a program to perform various 19 operations on List, Tuple and Dictionary by creating functions of each type. 15 Write a program that performs conversions of 25 a list, a tuple and a dictionary into each other. 16 Create a student table and insert data and 26 perform given SQL commands 17 Create a table 'employee' and insert data and 30 perform given SQL commands 18 Create a sports table and insert data 32
19 Integrate SQL with Python by importing 34
suitable module. PROGRAM 1 Read a text file line by line and display each word separated by a # text=open("demo.txt","r") words=[] for i in text: words.extend(i.split()) print("#".join(words)) text.close()