Session 2021-22
Practical file on Python and MySql
Name-Yash sharma
Class-XII “A”
Submitted to- submitted by-
Mr.riju nema yash sharma
Certificate
This is to certify that Yash Sharma of class
XII ‘A’ has successfully completed
practical file on “Python and mysql
programming” under the guidance of
Mr.Riju Nema.
The practical is absolutely genuine and
does not indulge in plagiarism of any
kind.
Signature (Examiner)________
Signature (Principal)_________
Signature (teacher)__________
Acknowledgement
I would like to express my special
thanks of gratitude to my teacher Mr.
Riju Nema Sir as well as our principle
Mr. Rajesh Sharma who gave me the
golden opportunity to do this wonder
practical on Python and Mysql
programming ,which also helped doing
a lot of research and I came to know
about so many new things I am really
thankful to them.Secondly I would also
like thank my parents and friends who
helped me a lot in finishing this project
within the limited time.
-Yash Sharma
Program Index
S.no Topic Page no.
1. 1.Program to read a text file line by line 6
and display each word separated by a ‘#’.
2. 2.Program to read a text file and display 7
the no.of
vowels/consonants/uppercase/lowercase
characters in the file-
3. Program to remove all the lines that 9
contains the character ’a’ in a file and
write it another file.
4. Program to create a binary file with name 11
and roll no.Search for a given roll no. and
display name,if not found display
appropriate message-
5. Program to update the marks on the 14
binary file
6. Program for a random number 15
generator that generates random
numbers between 1 and 6.
7. Program to create a CSV file by entering 16
user-id and password,read and search
the password for given user-id.
8. Program to find the smallest and largest 17
number from the list.
9. Program to take input for a list of 18
numbers and swap elements at the even
with the elements at the odd location.
10. Program to take input as a list and search 19
for a given element in the list
11. .Program to input a list of numbers and 20
find the smallest and largest from the
list-
12. Program to generate pattern 21
13. Program to compute the greatest 22
common divisor and least common
multiple of two integers-
14. Program to count and display the number 23
of
vowels,consonants,uppercase,lowercase
characters in a string-
15. Program to Input a string and determine 24
whether it is a palindrome or not
16. Program to implement a stack using list 25
17. .Creating a student table and inserting 26-33
data.Implementing these following sql
commands-
Alter table to add new
attributes.
Update table to modify
data
Order by to display data
in ascending/descending
order
Delete to remove tuple
Group by and find the
minimum,max,sum count
and average
1.Program to read a text file line by line and
dIsplAy eAch word sepArAted by A ‘#’.
Program code-
Program output-
2.Program to read a text file and display the
no.of vowels/consonants/uppercase/lowercase
characters in the file-
Program code-
Sample file-
Program output-
3.Program to remove all the lines that contains the
character ’a’ in a file and write it another file.
Program code-
File used for reading-
Program output-
File on which writing was done-
4.Program to create a binary file with name and roll
no.Search for a given roll no. and display name,if
not found display appropriate message-
Program code-
Program output-
5.Program to update the marks on the binary
file already created in program no 4.
Program code-same as program no.4
Program output-
6.Program for a random number generator that
generates random numbers between 1 and6.
Program input-
Program output-
7.Program to create a CSV file by entering user-
id and password,read and search the password
for given user-id.
Program code-
Program output-
8.Program to find the smallest and largest
number from the list.
Program code-
Program output-
9.Program to take input for a list of numbers
and swap elements at the even with the
elements at the odd location.
Program code-
Program output-
10.Program to take input as a list and search for
a given element in the list.
Program code-
Program output-
11.Program to input a list of numbers and find
the smallest and largest from the list-
Program code-
Program output-
12.Program to generate this pattern-
Pattern-
A
AB
ABC
ABCD
ABCDE
Program code-
Program output-
13.Program to compute the greatest common
divisor and least common multiple of two
integers-
Program code-
Program output-
14.Program to count and display the number
of vowels,consonants,uppercase,lowercase
characters in a string-
Program code-
Program output-
15.Program to Input a string and determine
whether it is a palindrome or not-
Program code-
Program output-
16.Program to implement a stack using list.
Program code-
Program output-
17.Creating a student table and inserting
data.Implementing these following sql
commands-
Alter table to add new attributes.
Update table to modify data
Order by to display data in ascending/descending order
Delete to remove tuple
Group by and find the minimum,max,sum count and
average
Creating a student table-
Adding new attributes-
descending order-
Updating table to modify
data-
Deleting a tuple from the table-
Group by and find the max/min/sum/count and average-
Max/min/sum/count and average-