PYTHON PRACTICAL FILE
PYTHON PRACTICAL FILE
SUBMITTED TO SUBMITTED BY
LIST OF PRACTICALS:
1
S.NO PROGRAM T. Sign
.
2 Write a program to show statistics of characters in the given line (to count the
number of alphabets, digits, uppercase, lowercase, spaces and other
characters).
4 Write a program to display those strings which are starting with ‘A’ from the
given list.
5 Write a program to find and display the sum of all the values which are
ending with 3 from a list.
9 Write a program to input the names of ‘n’ countries and their capital store in
a dictionary.
2
Ex d = {“India”:”New Delhi” ,……}
11 Write a function in python to read lines from text file poem.txt and display
words which are less than four character
12 Write a program to show and count the number of words in a text file
‘DATA.TXT’ which is starting with the words' The', ‘the’.
13 Write a program to read data from a text file DATA.TXT, and display each
word with a number of vowels and consonants.
14 Write a program to read data from a text file DATA.TXT, and display words
which have maximum/minimum characters.
16 Write a program to insert list data in a CSV File and print it.
The values for prod_code and prod_desc are strings, and the value for stock is
3
an integer.
Write a program in PYTHON to update the file with a new value of stock.
The stock and the product_code, whose stock is to be updated, are to be input
during the execution of the function.
( vehicletype, no_of_wheels)
Write a program to read all the records present in an already existing binary
file SPEED.DAT and display them on the screen, also count the number of
records present in the file.
19 Write a MENU DRIVEN program to show push and pop operation using
stack.
Sample output: Counter({'a': 400, 'b': 400, 'd': 400, 'c': 300})
4
Expected output:
23 Write a python program to connect to your database server and print its
version
Hospital
Hospital_id Hospital_Name Bad Count
Doctor
Doctor_id Doctor_Name Hospital_id Joining_Date Speciality Salary Exp
.
ii Get the list Of doctors as per the given specialty and salary
5
iv Update doctor experience in years
Output
2)Write a program to show statistics of characters in the given line (to count the number of
alphabets, digits, uppercase, lowercase, spaces and other characters).
6
3)Write a program to display frequencies of all the elements of a list.
4)Write a program to display those strings which are starting with ‘A’ from the given list.
Output
5)Write a program to find and display the sum of all the values which are ending with 3 from a
list.
Output
output
8
Output
9)Write a program to input the names of ‘n’ countries and their capital store in a dictionary.
Output
9
10
output
11)Write a function in python to read lines from text file poem.txt and display words which are
less than four character
10
13)Write a program to read data from a text file DATA.TXT, and display each word with a
number of vowels and consonants.
Output
11
14)Write a program to read data from a text file DATA.TXT, and display words which have
maximum/minimum characters.
12
Output
16)Write a program to insert list data in a CSV File and print it.
Output
13
17)Following is the structure of each record in a data file named” PRODUCT.DAT”.
The values for prod_code and prod_desc are strings, and the value for stock is an integer.
Write a program in PYTHON to update the file with a new value of stock. The stock and the
product_code, whose stock is to be updated, are to be input during the execution of the function.
14
15