PRACTICAL RECORD-CLASS-11 (2)

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

INFORMATICS PRACTICES

CLASS-XI
PRACTICAL RECORD(2022-23)
1. To find average and grade for given marks.

m1=int(input('ENTER ENGLISH MARKS:'))


m2=int(input('ENTER IP MARKS:'))
m3=int(input('ENTER BIOLOGY MARKS:'))
m4=int(input('ENTER PHYSICS MARKS:'))
m5=int(input('ENTER CHEMISTRY MARKS:'))
tot=m1+m2+m3+m4+m5
avg=tot/5
grade=''
if(m1>=33 and m2>=33 and m3>=33 and m4>=33 and m5>=33 ):
if(avg>=91):
grade='A1'
elif(avg>=81 and avg<91):
grade='A2'
elif(avg>=71 and avg<81):
grade='B1'
elif(avg>=61 and avg<71):
grade='B2'
elif(avg>=51 and avg<61):
grade='C1'
elif(avg>=41 and avg<51):
grade='C2'
elif(avg>=33 and avg<41):
grade='D'
result='PASS'
else:
result='FAIL'
grade='None'
print('\n')
print('TOTAL MARKS:',tot)
print('AVERAGE MARKS:',avg)
print('GRADE:',grade)
print('Result:',result)
Output:
ENTER ENGLISH MARKS:56
ENTER IP MARKS:89
ENTER BIOLOGY MARKS:87
ENTER PHYSICS MARKS:75
ENTER CHEMISTRY MARKS:41

TOTAL MARKS: 348


AVERAGE MARKS: 69.6
GRADE: B2
Result: PASS
2. To find sale price of an item with given cost and discount (%).

price=float(input("Enter Price : "))


dp=float(input("Enter discount % : "))
discount=price*dp/100
sp=price-discount
print("Cost Price : ",price)
print("Discount: ",discount)
print("Selling Price : ",sp)

Output:

Enter Price : 5200


Enter discount % : 10
Cost Price : 5200.0
Discount: 520.0
Selling Price : 4680.0
3. To calculate perimeter/circumference and area of shapes such as triangle,
rectangle, square and circle.
import math
def area_square(a):
area1=float(a*a);
print("Area of square is:",area1)
def area_circle(r):
area2=float(3.14*r*r);
print("Area of circle is:",area2)
def area_rectangle(a,b):
area3=float(a*b);
print("Area of rectangle is:",area3)
def area_triangle(x,y):
area4=float((x*y)/2);
print("Area of triangle is:",area4)
def peri_square(a):
peri1=float(4*a);
print("Perimeter of square is:",peri1)
def peri_circle(r):
peri2=float(2*3.14*r);
print("Perimter of circle is:",peri2)
def peri_triangle(a,b):
hypotenuse=float(math.sqrt(a*a+b*b))
peri3=float(a+b+hypotenuse)
print("Perimter of right angled triangle is:",peri3)
def peri_rectangle(a,b):
peri4=float(2*(a+b))
print("Perimter of rectangle is:",peri4)

side=float(input("enter the side of square:"))


area_square(side)
print()
peri_square(side)
radius=float(input("enter the radius of circle:"))
area_circle(radius)
peri_circle(radius)
length=float(input("enter the length of rectangle:"))
breadth=float(input("enter the breadth of rectangle:"))
area_rectangle(length,breadth)
peri_rectangle(length,breadth)
base=float(input("enter the base of right angled triangle:"))
height=float(input("enter the height of right angled triangle:"))
area_triangle(base,height)
peri_triangle(base,height)

Output:
enter the side of square:5
Area of square is: 25.0

Perimeter of square is: 20.0


enter the radius of circle:10
Area of circle is: 314.0
Perimter of circle is: 62.800000000000004
enter the length of rectangle:10
enter the breadth of rectangle:20
Area of rectangle is: 200.0
Perimter of rectangle is: 60.0
enter the base of right angled triangle:5
enter the height of right angled triangle:10
Area of triangle is: 25.0
Perimter of right angled triangle is: 26.18033988749895
4. To calculate Simple and Compound interest.
# Simple and Compound Interest

# Reading principal amount, rate and time


principal = float(input('Enter amount: '))
time = float(input('Enter time: '))
rate = float(input('Enter rate: '))

# Calcualtion
simple_interest = (principal*time*rate)/100
compound_interest = principal * ( (1+rate/100)**time - 1)

# Displaying result
print('Simple interest is:' , simple_interest)
print('Compound interest is:' ,compound_interest)

Output:
Enter amount: 50000
Enter time: 2
Enter rate: 2
Simple interest is: 2000.0
Compound interest is: 2019.9999999999995
5. To calculate profit-loss for given Cost and Sell Price.

cp=float(input("Enter the Cost Price : "));

sp=float(input("Enter the Selling Price : "));

if cp==sp:

print("No Profit No Loss")

else:

if sp>cp:

print("Profit of ",sp-cp)

else:

print("Loss of ",cp-sp)

Output:

Enter the Cost Price : 800

Enter the Selling Price : 900

Profit of 100.0
6. To calculate EMI for Amount, Period and Interest.

p=float(input('ENTER PRINCIPAL AMOUNT:'))

t=float(input('ENTER TIME PERIOD(IN YEARS):'))

r=float(input('ENTER RATE OF INTEREST:'))

si=p*t*r/100

tot=p+si

emi=tot/(12*t)

print('EMI AMOUNT:',emi)

Output:

ENTER PRINCIPAL AMOUNT: 50000


ENTER TIME PERIOD (IN YEARS):2
ENTER RATE OF INTEREST:12
EMI AMOUNT: 2583.3333333333335
7. To calculate GST.

p = float(input("Enter Original amount : "))

np = float(input("Enter net price : "))

# Calculating GST amount

GST_amount = np - p

# Calculating GST percentage

GST_percent = ((GST_amount * 100) / p)

print("GST = ",round(GST_percent),'%')

Output:

Enter Original amount : 1500

Enter net price : 1800

GST = 20 %
8. To calculate Income Tax
If annual income is less than or equivalent to Rs. 2,50,000, you will pay no tax.
If annual income is less than or equal to Rs. 5,00,000, your tax will be 5% of your total
income over Rs. 2,50,000.
If annual income is less than or equal to Rs. 7,50,000, your tax rate will be 10% of your
total income beyond Rs. 5,00,000, with an additional cost of Rs. 12,500.
If annual income is less than or equivalent to Rs. 10,00,000, your tax rate will be 15% of
your total income over Rs. 7,50,000, with an additional fee of Rs. 37,500.
If annual income is less than or equal to Rs. 12,50,000, your tax rate will be 20% of your
total income beyond Rs. 10,00,000, with an additional fee of Rs. 75,000.
If annual income is less than or equal to Rs. 15,00,000, your tax rate will be 25% of your
total income beyond Rs. 12,50,000, with an additional cost of Rs. 1,25,000.
If annual income exceeds Rs. 15,00,000, you will be taxed at 30% of the excess, with an
additional fee of Rs. 1,87,500.

annualincome = int(input('Enter your annual income = '))


if annualincome <= 250000:
taxAmount = 0
elif annualincome <= 500000:
taxAmount = (annualincome - 250000) * 0.05
elif annualincome <= 750000:
taxAmount = (annualincome - 500000) * 0.10 + 12500
elif annualincome <= 1000000:
taxAmount = (annualincome - 750000) * 0.15 + 37500
elif annualincome <= 1250000:
taxAmount = (annualincome - 1000000) * 0.20 + 75000
elif annualincome <= 1500000:
taxAmount = (annualincome - 1250000) * 0.25 + 125000
else:
taxAmount = (annualincome - 1500000) * 0.30 + 187500
print('The calculated income tax on ', annualincome, '=',
taxAmount)

Output:

Enter your annual income = 680000


The calculated income tax on 680000 = 30500.0
9. To find the largest and smallest numbers in a list.
NumList = []
Number = int(input("Please enter the Total Number of List Elements:
"))
for i in range(1, Number + 1):
value = int(input("Please enter the Value of %d Element : " %i))
NumList.append(value)

print("The Smallest Element in this List is : ", min(NumList))


print("The Largest Element in this List is : ", max(NumList))

Output:

Please enter the Total Number of List Elements: 5


Please enter the Value of 1 Element : 52
Please enter the Value of 2 Element : 64
Please enter the Value of 3 Element : 12
Please enter the Value of 4 Element : 48
Please enter the Value of 5 Element : 90
The Smallest Element in this List is : 12
The Largest Element in this List is : 90
10. To find the third largest/smallest number in a list.

NumList = []
Number = int(input("Please enter the Total Number of List Elements:
"))
for i in range(1, Number + 1):
value = int(input("Please enter the Value of %d Element : " %i))
NumList.append(value)
NumList.sort()
print('ORIGINAL LIST AFTER SORING:',NumList)
print("The third Smallest Element in this List is : ", NumList[2])
print("The third Largest Element in this List is : ", NumList[-3])

Ouput:
Please enter the Total Number of List Elements: 9
Please enter the Value of 1 Element : 15
Please enter the Value of 2 Element : 84
Please enter the Value of 3 Element : 75
Please enter the Value of 4 Element : 65
Please enter the Value of 5 Element : 32
Please enter the Value of 6 Element : 12
Please enter the Value of 7 Element : 48
Please enter the Value of 8 Element : 96
Please enter the Value of 9 Element : 1
ORIGINAL LIST AFTER SORING: [1, 12, 15, 32, 48, 65, 75, 84, 96]
The third Smallest Element in this List is : 15
The third Largest Element in this List is : 75
11. To find the sum of squares of the first 10 natural numbers.

n=int(input('ENTER YOUR RANGE:'))


x=0
s=0
for i in range(1,n+1):
x=i**2
s=s+x
if(i!=n):
print(x,end='+')
else:
print(x,end='=')
print(s)

Output:

ENTER YOUR RANGE:10


1+4+9+16+25+36+49+64+81+100=385
12. To print the first ‘n’ multiples of given number.

n = int(input("Enter number: "))

r=int(input('Enter range of multiples:'))

print("The multiples are: ")

for i in range(1,r+1):

print(n*i, end =" ")

Output:

Enter number: 8
Enter range of multiples:6
The multiples are:
8 16 24 32 40 48
13. To count the number of vowels in user entered string.

string=input("Enter string:")

vowels=0

for i in string:

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:")

print(vowels)

Output:

Enter string:informatics

Number of vowels are:

4
14. To print the words starting with a alphabet in a user entered string.

s = input("Enter any sentences : ")

a = input("Enter any alphabet to find :")

found = False

words = s.split()

for word in words:

if word.startswith(a):

print(word)

found = True

if (found == False):

print("No word starting with user entered

alphabet")

Output:

Enter any sentences : i am in the college

Enter any alphabet to find :i

in
15. To print number of occurrences of a given alphabet in each string.

s = input("Enter string value : ")


a = input("Enter any alphabet to count :")
found = False
count=0
for i in s:
if i==a:
count+=1
found = True
if (found == False):
print("No such alphabet in the given string")
else:
print('No of occurance of ',a,' in the given string ',s,'is:',count)

Output-1:

Enter string value : happy valley school

Enter any alphabet to count :y

No of occurance of y in the given string happy valley school is: 2

Output-2:

Enter string value : amar kumar

Enter any alphabet to count :j

No such alphabet in the given string


16. Create a dictionary to store names of states and their capitals.

statesAndCapitals = {
'Gujarat' : 'Gandhinagar',
'Maharashtra' : 'Mumbai',
'Rajasthan' : 'Jaipur',
'Bihar' : 'Patna'
}

print('List Of state wise capitals:\n')


print(statesAndCapitals)

Output:

List Of state wise capitals:

{'Gujarat': 'Gandhinagar', 'Maharashtra': 'Mumbai',


'Rajasthan': 'Jaipur', 'Bihar': 'Patna'}
17. Create a dictionary of students to store names and marks obtained in 5
subjects.
students = dict()
n = int(input("Enter number of students :"))
for i in range(n):
sname = input("Enter names of student :")
marks= []
for j in range(5):
mark = float(input("Enter marks :"))
marks.append(mark)
students[sname] = marks
print("Dictionary of student created :")
print(students)

Output:
Enter number of students :4
Enter names of student :sai
Enter marks :56
Enter marks :85
Enter marks :96
Enter marks :45
Enter marks :78
Enter names of student :kumar
Enter marks :56
Enter marks :96
Enter marks :85
Enter marks :74
Enter marks :29
Enter names of student :anil
Enter marks :63
Enter marks :96
Enter marks :23
Enter marks :65
Enter marks :45
Enter names of student :reddy
Enter marks :98
Enter marks :97
Enter marks :95
Enter marks :96
Enter marks :91
Dictionary of student created :
{'sai': [56.0, 85.0, 96.0, 45.0, 78.0], 'kumar': [56.0, 96.0, 85.0,
74.0, 29.0], 'anil': [63.0, 96.0, 23.0, 65.0, 45.0], 'reddy': [98.0,
97.0, 95.0, 96.0, 91.0]}

18. To print the highest and lowest values in the dictionary.

d={1:100,2:20,3:500,4:66,5:800,6:3}

max_no=max(d.values())

min_no=min(d.values())

print('Maximum no in the List:',max_no)

print('Minimum no in the List:',min_no)

Output:

Maximum no in the List: 800

Minimum no in the List: 3

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy