0% found this document useful (0 votes)
116 views14 pages

IP Prctical File Class XI

The document contains programs to perform various calculations and operations: 1. It contains 15 programs to calculate average and grade, sale price with discount, perimeter and area of shapes, simple and compound interest, profit/loss, EMI, tax (GST), find largest/smallest number in a list, sum of squares, multiples of a number, count vowels, and print words starting with a letter. 2. It also contains 3 SQL queries to create a student database and table, insert sample records, and delete records below a marks threshold.

Uploaded by

Monika Khanna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views14 pages

IP Prctical File Class XI

The document contains programs to perform various calculations and operations: 1. It contains 15 programs to calculate average and grade, sale price with discount, perimeter and area of shapes, simple and compound interest, profit/loss, EMI, tax (GST), find largest/smallest number in a list, sum of squares, multiples of a number, count vowels, and print words starting with a letter. 2. It also contains 3 SQL queries to create a student database and table, insert sample records, and delete records below a marks threshold.

Uploaded by

Monika Khanna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

1. Write a python program 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)

TERM 1 CLASS XI IP PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 5


Output of Program 1:

2. Write a python program to find the sale price of an item with a 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)

Output of program 2:

TERM 1 CLASS XI IP PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 6


3. Write a python program 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)
Output of Program 3

TERM 1 CLASS XI IP PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 7


4. Write a program 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))
Ouptut for Program 4:

5. Write a program to calculate profit-loss for a given Cost and Sell Price.
#input cost and sales amount
cost = float(input("Enter the cost of the product: "))
sale_amt = float(input("Enter the Sales Amount: "))
#declare a variable to store profit and loss
amt=0
#Actual process to compute profit or loss
if(cost > sale_amt):
amt = cost - sale_amt
print("Total Loss Amount = ",amt)
elif(cost < sale_amt):
amt = sale_amt - cost
print("Total Profit =",amt)
else:
print("No Profit No Loss!!!")
Output for Program 5:

TERM 1 CLASS XI IP PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 8


6. Write a program to calculate EMI for Amount, Period and Interest.
# driver code
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)
Output for Program 6:

7. Write a program to calculate tax - GST


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)
Output for Program 7

8. Write a program 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)

TERM 1 CLASS XI IP PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 9


9. Write a python program 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)


Output of program 9

10. Write a program 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)
Output of Program 10:

11. Write a program to print the first ‘n’ multiples of a 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))
Output of Program 11:

TERM 1 CLASS XI IP PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 10


12. Write a program to count the number of vowels in a 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)
Output of Program 12

13. Write a program to print the words starting with a particular 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)
Output for program 13

14. 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)
Output of program 14

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)
Output of program 15

TERM 1 CLASS XI IP PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 11


1. Create Database Named Class11
create database class11;

2. Open Database Class 11


use class11;

3. Create a student table with the student id, class, section, gender, name, dob,
andmarks 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));

TERM 2 CLASS XI IP PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 5


4. View the structure of the table
desc student; OR
describe student

5. 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);

TERM 2 CLASS XI IP PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 6


6. Display the details of the student table.
select * from student;

TERM 2 CLASS XI IP PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 7


7. Delete record of students who secured less than 65 marks.
delete from student where marks <65;

8. Increase marks by 5% for who have studentid more than 1105.


update stduent set marks=makrs+(marks*0.05) where studentid>1105;

9. Display the content of the table of female students.


select * from student where gender = 'f';

TERM 2 CLASS XI IP PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 8


10. Display studentid, Name and Marks whose marks are more than 50.
select studentid,name,marks from student where marks>50;

11. Find the average of marks from the student table.


select avg(marks) from student;

12. Find the number of students, who are from section ‘A’.
alter table student add column email varchar(20);

13. Add a new column email in the above table.


alter table student add column email varchar(20);

TERM 2 CLASS XI IP PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 9


14. Add the email ids of each student in the created email column.
update student set email='[email protected]';

15. Display the information of all the students, name contains ‘sh’
select * from student where name like 'sh%';

16. Display the information of all the students, name starts with ‘sh’
select * from stduent where name like 'sh%';

17. Display studentid, Name, DOB of who are born in 2005


select studentid, name, dob from student where dob between '2005-01-
01' and '2005-12-31';

TERM 2 CLASS XI IP PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 10


18. Display studentid, Name, DOB, Marks, Email of male students in ascending
order of their names.
select studentid, name, dob from student order by name;

19. Display stduentid, Gender, Name, DOB, Marks, Email in descending order of
their marks.
select studentid, gender, name, dob, marks, email from student order
by marks desc;

20. Display the unique section available in the table.


select distinct section from student;

TERM 2 CLASS XI IP PRACTICAL FILE | Downloaded from www.tutorialaicsip.com | Page 11

You might also like