Computer Practical List
Computer Practical List
Computer Practical List
4. Using the matplotlib library of Python, plot the line graph for the following:
(i) to calculate the value of y= sin(x) using its Taylor series expansion up to n terms.
5.(i)Write a Python program to create a pie chart of gold medal achievements of five most
successful countries in 2016 Summer Olympics. Sample data:
• Traversal in a list
• Insertion in a sorted list
• Deletion of an element from a list
1
7. Write a menu driven program to perform Searching Techniques in a list using
• Linear Search
• Binary Search
• Bubble Sort
• Insertion Sort
• Push
• Pop
• Peek
• Display Stack
• Exit
• Enqueue
• Dequeue
• Display Queue
• Exit
12. Write a Program in Python to count and display the number of lines not starting with alphabet 'A'
present in a text file "STORY.TXT”. Example: If the file "STORY.TXT" contains the following lines,
(ii) to compute sum of all elements, sum of each column and sum of each row.
* 15. Write a Django based web application and write the data to a csv file.
* 16. Write a program to connect Python with MySQL using database connectivity and perform the
following operations on data in database: Fetch, Update and delete the data.
A .CREATE A TABLE
import mysql.connector
demodb = mysql.connector.connect(host="localhost", user="root",
passwd="computer", database="EDUCATION")
democursor=demodb.cursor( )
democursor.execute("CREATE TABLE STUDENT (admn_no int primary key,
sname varchar(30), gender char(1), DOB date, stream varchar(15), marks float(4,2))")
import mysql.connector
demodb = mysql.connector.connect(host="localhost", user="root",
passwd="computer", database="EDUCATION")
democursor=demodb.cursor( )
democursor.execute("insert into student values (%s, %s, %s, %s, %s, %s)",
(1245, 'Arush', 'M', '2003-10-04', 'science', 67.34))
demodb.commit( )
import mysql.connector
demodb = mysql.connector.connect(host="localhost", user="root",
passwd="computer", database="EDUCATION")
democursor=demodb.cursor( )
democursor.execute("select * from student")
for i in democursor:
print(i)
import mysql.connector
demodb = mysql.connector.connect(host="localhost", user="root",
passwd="computer", database="EDUCATION")
democursor=demodb.cursor( )
democursor.execute("update student set marks=55.68 where admn_no=1356")
demodb.commit( )
3
E. DELETE THE DATA
import mysql.connector
demodb = mysql.connector.connect(host="localhost", user="root",
passwd="computer", database="EDUCATION")
democursor=demodb.cursor( )
democursor.execute("delete from student where admn_no=1356")
demodb.commit( )
1.Write the SQL commands for the following on the basis of SCHOOL BUS relation given below:
i. To show all records students more than the capacity in order of RTNO
ii. To show area covered for buses covering more than 20Km,but charges less than 80000
iii. To show transporter wise total no of students traveling
iv. To show RTNO, area_covered and average cost per student for all routes
v. Add a new record with following data: (11,”mohit bagh”,35,32,10,”Kiran Tours” ,35000)
2.Write SQL commands for the following on the basis of table Hospital given below.
4
10 Shailya 31 Nuclear Medicine 19/02/98 400 M
4.Write SQL commands for the following on the basis of the tables given below: WORKER
Paylevel
Plevel Pay Allowance
P001 26000 12000
P002 22000 10000
P003 12000 6000
5.Given the following Lab table, write SQL commands for the following statements.
5
No ItemName CostPerItem Quantity DateOfPurchase Warranty Operational
1. Computer 60000 9 21/5/96 2 7
2. Printer 15000 3 21/5/97 4 2
3. Scanner 18000 1 29/8/98 3 1
4. Camera 21000 2 13/10/96 1 1
5. Switch 8000 1 31/10/99 2 1
6. UPS 5000 5 21/5/96 1 4
7. Plotter 25000 2 11/1/2000 2 5
6.Write SQL Queries for the following EMPLOYEE and SALGRADE tables.
EMPLOYEE
ECODE NAME DESIG SGRADE DOJ DOB
101 Abdul Executive S03 23-Mar-2003 13-Jan-1980
102 Ravi Head – IT S02 12-Feb-2010 22-Jul-1987
103 John Receptionist S03 24-Jun-2009 24-Feb-1983
105 Nazar GM S02 11-Aug-2006 03-Mar-1984
106 Priyam CEO S01 29-Dec-2004 19-Jan-1982
SALGRADE
7.Write SQL commands for the following on the basis of the relations Stationery and Consumer given below:
6
Stationery Consumer
S_ID StationeryName Company Price C-ID ConsumerName Address S_ID
DP01 Dot Pen ABC 10 01 Good Learner Delhi PL01
PL02 Pencil XYZ 6 06 Write Well Mumbai GP02
ER05 Eraser XYZ 7 12 Topper Delhi DP01
PL01 Pencil CAM 5 15 Write & Draw Delhi PL02
GP02 Gel Pen ABC 15 16 Motivation Bangalore PL01
8.Write SQL commands for the following based on the tables Employee and Salary given below:
Employee Salary
Eid Name Deptid Qualification Sex Eid Basic D.A HRA Bonus
1 Deepali 101 MCA F 1 6000 2000 2300 200
2 Rajat 101 BCA M 2 2000 300 300 30
3 Hari 102 B.A M 3 1000 300 300 40
4 Harry 102 M.A M 4 1500 390 490 30
5 Sumit 103 B.Tech M 5 8000 900 900 80
1.To list the names of those employees whose name which starts with ‘H’.
2.To display the name of the employee who has the maximum basic.
3. To display the number of employees department wise.
4. To add the new column named Total_Sal to the salary table.
5.To display all male employees whose Basic is greater than 2000.
9. Write SQL commands for the following on the basis of Bank relation given below:
1.Display data for all customers whose transactions are between 8 and 11.
2.Display data for all sorted by their dateofopen in descending order.
3.To count number of customers with amount<30000.
4.List the minimum and maximum amount from the bank.
5.To list Cname , Bname ,amount for all the clients whose amount is <20000.
7
********************************