Practical Assignments
1. Write a Program to find the area of a rectangle (the function must return values).
2. Write a Program to find the factorial of a number using function.
3. Write a Program to Pass a list to function to find the sum and average of the numbers
and return the values.
[Link] a Program to input n numbers in tuple and pass it to function to count how
many even and odd numbers are entered.
5. Write a Program using function to count how many times any character is present in
string .
6. Write a Program to create a text file [Link] and enter any three lines in that file.
7. Write a Program to read the file [Link] created in the previous program.
[Link] a Program to get the book no, book name ,author name and price of books and
store the details in a file “[Link]”.
9. Write a program to get student data (rollno,name,marks) from user and write onto a
binary file “[Link]”.The program should be able to get data from the user and write
onto the file as long as the user wants.
10. Write a Program to open the binary file “[Link]” and read the contents of the file.
11. Write a Program to open the binary file “[Link]” and search for records with roll
numbers as 1 or 3 .If found display the records.
12. The librarian keeps the record (index no and names) of all the books of class 11 and
12 in the file “[Link]”. Write a function def book() to add few more books in the file
“[Link]” to keep the records updated. Finally open the file in appropriate mode to
retrieve and display the elements.
13. Write a python code to store some integer numbers as a list element in the binary
file “[Link]” till the user wants. Finally open the file in appropriate mode to
retrieve and display the elements.
14. Write a Program to create a CSV file to store student details
(Rollno,Name,Marks).Get the data from the user and write 5 records into the file.
15. Write a program to read the csv file created in the previous program.
16. Write a program to implement stack using list data structure.
SQL Assignments
17. Consider the following table and perform the following queries and also draw the
output table.
Table:-Employee
Emp_Id Name Departmen t Designation Basic
1001 Rajib Computer Admin 15000
1002 John Sales Executive 13000
1003 Minakshi Operation Manager 17000
1004 Shreyas Accounts Operator 7000
1005 Sudhir Computer Operator 7000
i) Create a table for the above structure and insert values.
ii) Show the information of the employee whose basic is above 10000
iii)Show the name and department of those employee whose name starts with ‘S’
iv) Update Basic of those Employee by 12% whose basic is less than or equal to 8000.
v)Display the sum of basic of each Department.
vi) Count the number of Employees in each Department.
vii) Add a new attribute join_date of type date to the existing table
viii) Update the table and insert the joining date of each employee.
ix) Display the Employee details who joined in the month of December
x) To delete the employee whose EMP_ID is 1003.
Python Mysql Connectivity programs
18. Write a python program to create a table student with the following attributes.
Rollno int(3) primary key
Name varchar(15)
age integer
city char(8)
19. Write a python program to insert records into student table.
20. Write a program to view the data’s of student table.
21. Write a python program to fetch one record from the table student.
22. Write a program to fetch first three record from the table student.
23. Write a python program to change the age of a student whose name is Pooja and
make the new age 35.