1(a)
(b)
2.
1(a)
(b)
2.
import pandas as pd
import [Link] as mpp
#Answer 1
data={'BookID':['B0001','B0002','B0003','B0004','B0005','B0006'],\
'Subject':['Computer Science','Computer Science','Computer Appllications',\
'Informatics Practices','Artificial Intelligence','Informatics Practices'],\
'Class':['XII','XII','X','XII','IX','XII'],\
'Publisher':['NCERT','Dhanpat Rai','BPB','NCERT','KIPS','Oswal books'],\
'Price':[270,340,120,270,340,299]}
books=[Link](data)
#Asnwer 2
print("Class XII Books:")
print(books[books['Class']=='XII'].to_string(header=False,index=False))
print("***********************************************************")
#Asnwer 3
print("Books having price more than 250")
print(books[books['Price']>250].to_string(header=False,index=False))
#Answer 4
[Link](x='Subject',y='Price',kind='bar')
[Link]()
2. Month=[‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’, ‘Jun’]
msaving=[1000, 500, 700, 550, 600, 800]
3. Solution:
1 Create table:
create table students (rollno int(4) primary key,name varchar(20) not null,class varchar(4),dob date,
gender char(1),city varchar(20),marks float);
2 Insert records:
insert into students values
(1, 'Naman', 'XII','1995/05/09','M','Anand',453)
Insert all records simimlarly.
3 display the detail of class XII students in descending order of their marks
select * from students order by marks desc;
4 Display all the details of students in ascending order of name
select * from students order by name asc
5 Find the maximum marks of the student for each class
select class,max(marks) from students group by class
6 Count the students class wise is display only those number who is more than 2
select class,count(*) from students group by class having count(*)>2;
7 Display unique cities from the table
select distinct city from students;