PRACTICAL FILE-2024-25
CLASS-XI
INFORMATICS PRACTICES (065)
KENDRIYA VIDYALAYA
NO.2 RAIPUR
SUBMITTED BY:
Roll No:……………….
Name:……………………..
Date:………………….
Signature of Internal Examiner:
(Arvind Bhatpahare)
1. To find average and grade for given marks.
mm=int(input("Enter the maximum marks:"))
eng=int(input("Enter the marks of English:"))
acc=int(input("Enter the marks of Accountancy:"))
bs=int(input("Enter the marks of Business Studies:"))
eco=int(input("Enter the marks of Economics:"))
ip=int(input("Enter the marks of Informatics Practices:"))
tot=eng+acc+bs+eco+ip
t_mm=mm*5 per=(tot/t_mm)*100
print("Average is:",per,"%")
if per>=91 and per<=100:
gr='A1'
elif per>=81 and per<=90:
gr='A2'
elif per>=71 and per<=80:
gr='B1'
elif per>=61 and per<=70:
gr='B2'
elif per>=51 and per<=60:
gr='C1'
elif per>=41 and per<=50:
gr='C2'
elif per>=33 and per<=40:
gr='D'
else:
gr="Invalid Grade"
print("The Grade is:",gr)
2. To find sale price of an item with given cost and discount (%).
cost=float(input("Enter the cost : "))
dis_per=float(input("Enter the discount in % : "))
dis=cost*dis_per/100
sel_price=cost-dis
print("Cost Price : ",cost)
print("Discount: ",dis)
print("Selling Price : ",sel_price)
3. To calculate perimeter/circumference and area of shapes such as
triangle, rectangle, square and circle.
import math
side=float(input("Enter the side of square:"))
ar_sq=float(side*side)
print("Area of Square:",ar_sq)
peri=float(4*side);
print("Perimeter of square is:",peri)
print()
r=float(input("enter the radius of circle:"))
ar_ci=float(3.14*r*r)
print("Area of circile:",ar_ci)
per_ci=float(2*3.14*r);
print("Perimter of circle is:%.2f"%per_ci)
print()
l=float(input("enter the length of rectangle:"))
b=float(input("enter the breadth of rectangle:"))
ar_rect=float(l*b)
print("Area of rectangle is:",ar_rect)
per_rect=float(2*(l+b))
print("Area of rectangle is:",per_rect)
print()
ba=float(input("enter the base of right angled triangle:"))
h=float(input("enter the height of right angled triangle:"))
ar_tri=float(float((ba*h)/2))
print("Area of triangle is:",ar_tri)
hpt=float(math.sqrt(h*h+ba*ba))
peri_tri=float(h+ba+hpt)
print("Perimter of right angled triangle is:",peri_tri)
4. To calculate Simple and Compound interest.
#input
p = float(input('Enter the principal amount: '))
r = float(input('Enter the rate of interest: '))
t = float(input('Enter the time duration: '))
#process
si = (p*r*t)/100
ci= p * ( (1+r/100)**t - 1)
#output
print('Simple interest is: %.2f' % (si))
print('Compound interest is: %.2f' %(ci))
5. To calculate profit-loss for given Cost and Sell Price.
cost_price=float(input("Enter the cost Price of an Item :"))
selling_price=float(input("Enter the Selling Price of an Item :"))
if (selling_price > cost_price):
profit = selling_price - cost_price
print("Profit :",profit)
elif( cost_price > selling_price):
loss = cost_price - selling_price
print("Loss :",loss)
else:
print("No Profit No Loss")
6.To calculate EMI for Amount, Period and Interest.
p = float(input("Enter the principal:"))
r = float(input("Enter the rate of interest:"))
t = float(input("Enter the time:"))
#intereset
r = r / (12 * 100)
#total installments
t = t * 12
emi = (p * r * pow(1 + r, t)) / (pow(1 + r, t) - 1)
print("Monthly EMI is= %.2f"%emi)
7.To calculate tax - GST / Income Tax.
op=float(input("Enter original Price:-"))
np = float(input("Enter Net Price:-"))
GST_amt = np - op
GST_per = ((GST_amt * 100) / op)
print("GST Rate = %.2f"%GST_per,"%")
print("GST Amount = ",GST_amt)
8.To find the largest and smallest numbers in a list.
l = []
n = int(input("Enter the Number of List Elements: "))
for i in range(1, n + 1):
ele = int(input("Please enter the Value of Element%d : " %i))
l.append(ele)
mx = mn = l[0]
for j in range(1, n):
if(mn > l[j]):
mn = l[j]
min_pos = j
if(mx < l[j]):
mx = l[j]
max_pos = j
print("The Smallest Element in the List is : ", mn)
print("The position of Smallest Element in the List is : ", min_pos)
print("The Largest Element in the List is : ", mx)
print("The position of Largest Element in the List is : ", max_pos)
9.To find the third largest/smallest number in a list.
l = []
n = int(input("Enter the Number of List Elements: "))
for i in range(1, n + 1):
ele = int(input("Please enter the Value of Element%d : " %i))
l.append(ele)
large = l[0]
sec_large = l[0]
third_large = l[0]
for i in l :
if i > large:
third_large = sec_large
sec_large = large
large = i
elif i > sec_large :
third_large = sec_large
sec_large = i
elif i > third_large:
third_large = i
print("Third largest number of the list is:",third_large)
10. To find the sum of squares of the first 100 natural numbers.
sum1 = 0
for i in range(1, 101):
sum1 = sum1 + (i*i)
print("Sum of squares is : ", sum1)
11. To print the first ‘n’ multiples of given number.
#input
n = int(input("Enter the number to display multiples:"))
m = int(input("Enter the number to display n multiples:"))
#computing multiples
multip = range(n, (n * m) + 1, n)
print(list(multip))
12. To count the number of vowels in user entered string.
txt=input("Enter string:")
vowels=0
for i in txt:
if(i=='a' or i=='e' or i=='i' or i=='o' or i=='u' or i=='A' or
i=='E' or i=='I' or i=='O' or i=='U'):
vowels=vowels+1
print("Number of vowels are:",vowels)
13. To print the words starting with a alphabet in a user entered
string.
txt=input("Enter the text:")
al=input("Enter alphabet to print the words:")
for i in txt.split():
if i.startswith(al):
print(i)
14. To print number of occurrences of a given alphabet in each
string.
a=input("Enter the alphabet:")
target = 'l'
count = 0
for c in s:
if c == a:
count += 1
print(count)
15. Create a dictionary to store names of states and their capitals.
st={'Gujarat':'Ghandhinagar','Rajasthan':'Jaipur','Bihar
':'Patna','Maharashtra':'Mumbai','Madhya
Pradesh':'Bhopal'}
print(st)
16. Create a dictionary of students to store names and marks obtained
in 5 subjects.
students={'Aksh':[34,46,48,33,47],'Bhavik':[44,45,48,43,42]}
print(students)
17. To print the highest and lowest values in the dictionary.
marks={"m1":78 , "m2":89 , "m3":64 , "m4":35 , "m5":71}
v = marks.values()
maxi = max(v)
mini = min(v)
print("Maximum :",maxi)
print("Minimum :",mini)
Data Management: SQL Commands
1. To create a database
create database class11;
use class11;
2. To create student table with the student id, class,
section, gender, name, dob, and marks as attributes
where the student id is the primary key.
create table student
(studentid int(4) primary key,
class char(2), section char(1),
gender char(1), name varchar(20),
dob date, marks decimal(5,2));
desc student; OR describe student
3. To insert the details of at least 10 students in the
above table.
insert into student values
(1101,'XI','A','M','Aksh','2005/12/23',88.21),
(1102,'XI','B','F','Moksha','2005/03/24',77.90),
(1103,'XI','A','F','Archi','2006/04/21',76.20),
(1104,'XI','B','M','Bhavin','2005/09/15',68.23),
(1105,'XI','C','M','Kevin','2005/08/23',66.33),
(1106,'XI','C','F','Naadiya','2005/10/27',62.33),
(1107,'XI','D','M','Krish','2005/01/23',84.33),
(1108,'XI','D','M','Ayush','2005/04/23',55.33),
(1109,'XI','C','F','Shruti','2005/06/01',74.33),
(1110,'XI','D','F','Shivi','2005/10/19',72.30);
4. To display the entire content of table.
select * from student;
5. To display Rno, Name and Marks of those students who
are scoring marks more than 50.
select studentid,name,marks from student where marks>50;
6. To display Rno, Name, DOB of those students who are
born between ‘2005- 01-01’ and ‘2005-12-31’.
select studentid, name, dob from student where dob between '2005-
01-01' and '2005-12-31';