Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

Certificate

This is to certify that _________________, of class 12th


Session 2023-24 have prepared the Practical File as per the
prescribed Practical Syllabus of Informatics Practices
Code-065 Class-12th AISSCE(CBSE) under my supervision.

It is the original work done by her/him.


Her/Him work is really appreciable. I wish her/him a very
bright success.

___________________ ___________________
Signature of Teacher Signature of External
Index
MYSQL:
→ Create a Database ‘School’ on the database server
→ create the following table named ‘STUDENT’
→ insert the following records into the table
→ Display info of males whose city, is neither Delhi nor Mumbai

→ Display info students whose d.o.b. is after ____ birthdate ___


→ Display all info about class XIIth students rank Wise
→ display columns arranged in descending order and ascending order
→ List names of students whose name has the character ‘a’
→ Display name and marks of students whose marks is in the range of 400 and 500

→ Display AVG marks, highest marks and total number of students


→ display total number of males and females separately, along with their average marks
→ Increase the marks of 10th class students by 5% mark
→ Add a new column named ‘Address’

→ Add primary key to the column ‘name’


→ Display name, class and city of 12th class students
→ Display unique values under sex field
→ Display name, d.o.b. and day name of females whose, marks is greater than or equal to 400

→ Display city and highest marks of students of Delhi and Mumbai


→ Display round of average marks up to zero places
→ Write a query to display name and the position of character ‘a’
→ Display name, character number 3rd and 4th
→ Display current date and current time together

→ display name, marks and round up the square root of marks up to two decimal places
Pandas (Series):
→ Create a panda's series from a dictionary of values and a ndarray or predefined array.
→ Showing series various attributes
→Write a Program to show the utility of head and tail functions of Panda series in python.
→ Mathematical operations on series

→ Selection, Indexing and Slicing in Series

Pandas (DataFrame):
→ Write a Program to enter data and show data in python using dataFrames.

→ Adding a column and a row in a dataframe.


→ Write a Program to read CSV file and show its data in python using dataFrames and pandas.
→ Deleting a row and column from a dataframe
→ Create a Data Frame quarterly sales where each row contains the item category, item name, and
expenditure

Visualisation (Matplotlib):
→ Write a program to plot bar chart having Cities along with their Population on x-axis and y-axis.
→ Write a program to plot a line chart with title,xlabel, ylabel and line style.

→ Write a program to plot line chart showing sales of different items in a month.
→ Write a program to display the runs scored by different batsman in a tournament
→ Make a histogram to show the comparison between blood sugar levels of men
MYSQL:
→ Create a Database ‘School’ on the database server,show the list
of databases and open it
Solution:

→ Create the following table named ‘STUDENT’(Name, class, DOB,


sex, city, marks) with appropriate data type, size and constraint(s) if
any
Solution:
→ insert the following records into the table
Name Class DOB Sex City Marks
Yash XII 1995-06-06 M Faridabad 489
Akansha XI 1993-07-05 F Faridabad 462
Jatin X 1994-05-06 M Delhi 350
Rishika XII 1995-08-08 F Faridabad 472
Anshika X 1995-10-08 F Delhi 377
Bhumika X 1994-12-12 F Mumbai 369
Yachak XII 1994-12-08 M Faridabad 410
Harshit XI 1995-12-06 M Delhi 250
Solution:

→ Display info of males whose city, is neither Delhi nor Mumbai


Solution:

→ Display info students whose d.o.b. is after Harshit’s birthdate


1995-12-06
Solution:
→ Display all info about class XIIth students rank Wise by marks
Solution:

→ Display all columns arranged in descending order of city and


within the city in the ascending order their marks.
Solution:

→ List names of students whose name has the character ‘a’

Solution:
→ Display name and marks of students whose marks is in the range
of 400 and 500(both are exclusive)
Solution:

→ Display AVG marks, highest marks and total number of students


for each class
Solution:

→ display total number of males and females separately , along


with their average marks
Solution:
→ Increase the marks of 10th class students by 5% mark
Solution:

→ Add a new column named ‘Address’


Solution:

→ Add primary key to the column ‘name’


Solution:
→ Display name, class and city of 12th class students
Solution:

→ display unique values under sex field


Solution:

→ Display name, d.o.b. and day name of females whose, marks is


greater than or equal to 400
Solution:
→ Display city and highest marks of students of Delhi and Mumbai
Solution:

→ Display round of average marks up to zero places, truncate of


average marks up to 1 decimal place for class 10th students only
Solution:

→ Write a query to display name and the position of character ‘a’


Solution:

→ Display name, character number 3rd and 4th and number of


characters in each name
Solution:
→ Display current date and current time together
Solution:

→ display name, marks and round up the square root of marks up


to two decimal places
Solution:

PYTHON PANDAS (SERIES)


→ Create a panda's series from a dictionary of values and a
ndarray or predefined array.
Code:
import pandas as pd
import numpy as np
#series from a dictionary
d1={"P":13,"Q":29,"R":41,"S":21}
s11=pd.Series(d1)
print(s11)
#utility of numpy in python
n1=np.array([13,29,41,21,29])
s4=pd.Series(n1,index=['a','b','c','d','e'])
print(s4)

Output:

→Showing series various attributes


Code:
import pandas as pd
s1=pd.Series([10,18,25,20,34],index=[1,2,3,4,5])
#attribute of series
print(s1.index)
print(s1.values)
print(s1.dtype)
print(s1.shape)
print(s1.size)
print(s1.empty)
print(s1.ndim)

Output:
→Write a Program to show the utility of head and tail functions of
Panda series in python.
Code:
import pandas as pd
#utility of head and tail functions in series
s1=pd.Series([20,28,31,14,17], index=["p","q","r","s","t"])
#to get the last two rows
print(s1.tail(2))
#to get the first 3 rows
print(s1.head(3))

Output:

→Mathematical operations on series


Code:
import pandas as pd

#mathematical operations on series


s2=pd.Series(list(range(0,18,3)))
s3=pd.Series(list(range(11,0,-2)))
print(s2-s3)

print(s2*2)
print(s2+s3)
print(s2/s3)

Output:
→Selection, indexing and slicing in series
Code:
import pandas as pd
#selecting,indexing and slicing in series
s1=pd.Series([18,28,26,19,41],index=['a','b','c','d','e'])
s2=pd.Series([10,15,23,35,12],index=['p','q','r','s','t'])
print(s1[3])
print(s2[2:6])

Output:

(DATAFRAME)
→Write a Program to enter data and show data in python using
dataFrames .
Code:
import pandas as pd
#entering and showing data in dataframe
dict1={2020:[102.3,152.6,203.9,20000,35000],2021:[13500,19540,22000,25000,45000
],2022:[15000,45000,56000,100400,135000],2023:[50000,60000,70000,80000,90000]}
sales =pd.DataFrame(dict1,index=['yash','yachak','garima','jatin','akansha'])
print(sales)

Output:

Adding a column and a row in a dataframe.


Code:
import pandas as pd
dict1={'X':[15,25,20],'Y':[10,30,20],'Z':[20,30,25],'P':[20,50,10],'Q':[60,40,20]}
Df2=pd.DataFrame(dict1,index=['s','d','f'])
#adding a column
Df2['R']=[30,80,40]
#adding a row
Df2.loc['g']=[4,8,12,16,20,24]
print(Df2)

Output:
→Write a python program to read CSV file and show its data in
python using dataFrames and pandas.
Code:
import pandas as pd
L1=['p101','yash',60]
L2=['p102','yachak',61]
L3=['p103','jatin',73]
L4=['p104','aksh',52]
Df1=pd.DataFrame([L1,L2,L3,L4],columns=['Pcode','name','marks'])
#dataframe to csv
Df1.to_csv('ip.csv')
#csv to dataframe
ab=pd.read_csv('ip.csv')
print(ab)

Output:

→Deleting a row and column from a dataframe


Code:
import pandas as pd
dict1={'P':[20,30,40],'Q':[10,40,30],'R':[50,40,60],'S':[40,10,80],'T':[50,60,30]}
df2=pd.DataFrame(dict1,index=['a','b','c'])
#deleting a column
df2=df2.drop(['P'],axis=1)
#deleting a row df2=df2.drop("a",axis=0)
print(df2)

Output:

→Create a dataframe quarterly sales where each row contains the


item category,itemname,and expenditure
Code:
import pandas as pd
d_qs={'i_category':['digital','computeraccesories','home
accessories'],'item_name':['T.V.','GraphicCard','flower
vase'],'expenditure':[20000,150000,1200]}
q_sales=pd.DataFrame(d_qs)
print(q_sales)

Output:

Matplotlib
→Write a python program to plot bar chart having cities along with
their population on xaxis and yaxis
Code:
import matplotlib.pyplot as plt
City=['Haryana','Delhi','Mumbai','Tamil Nadu','Chennai']
Population=[400,200,600,900,1200]
plt.bar(City,Population)
plt.show()

Output:

→Write a program to plot a line chart with title,xlabel,ylabel and


line style.
Code:
import matplotlib.pyplot as plt

Name=['Yash','Yachak','Jatin','Rishika','Akansha','shrishti','Bhumika','Anshika']

Age=[16,17,14,12,10,6,13,9]

plt.plot(Name,Age,linestyle=':',color='red')

plt.xlabel('name of children')

plt.ylabel('age in years')

plt.title('age and name of children in a society')

plt.show()

Output:
→Write a program to plot a line chart showing sales of different
items in a month
Code:
import matplotlib.pyplot as plt
plt.figure(figsize=(9,5))
i_name=['angry bird','teentitan','marvel comics','colorme','wapppro','maths
formula','drag race']
sale=[80,120,40,550,60,30,130]
plt.plot(i_name,sale,linewidth=2,color='orange',marker='*',markersize=10,linestyle=':')
plt.xlabel('item_name')
plt.ylabel('per month sale')
plt.show()

Output:

→Write a program to display the runs scored by different


batsman in a tournament
Code:
import matplotlib.pyplot as plt
import pandas as pd
dict1={"batsman":["Kohli","smith","babar","rohit","williamson","butler"],2019:[2600,
2403,1125,902,1647,2236],2020:[1800,2006,1967,2658,1936,2547],2021:[2021,1
911,1345, 1923,1789,1832],2022:[2100,2012,1983, 1874, 1789,1823]}
df1=pd.DataFrame(dict1)
df1.set_index("batsman",inplace=True)
df1.plot(kind="bar",color=["r","b","y","g","k","orange"],fill=False,hatch='*',edgecolor
="magenta",figsize=(10,6))
plt.show()

Output:

→Make a histogram to show the comparison between blood


sugar levels of men and women
Code:
import matplotlib.pyplot as plt
men=[150,106,87,203,121,151,95,250,190,101,103]
women=[100,90,80,93,104,107,101,110,112,120,132]
plt.xlabel("sugar range")
plt.ylabel("total no. of patients")
plt.title("blood sugar analysis")
plt.hist([men,women],bins=[70,120,170,220,270],linewidth=2,edgecolor="black", linestyle="--",
label=["men", "women"])
plt.legend()
plt.show()

Output:

You might also like