INFORMATIC PRACTICES
PYTHON PRACTICAL 1
1. name=input('enter your name-')
eng=eval(input('enter english marks-'))
bs=eval(input('enter business studies marks-'))
acc=eval(input('enter accountancy marks-'))
eco=eval(input('enter economics marks-'))
ip=eval(input('enter informatics practices marks-'))
percent=(eng+bs+acc+eco+ip)/500*100
print('percentange of marks=',(eng+bs+acc+eco+ip)/500*100)
if percent<=100 and percent<=80:
print('A grade')
elif percent<=79 and percent>=60:
print('B grade')
elif percent<=59 and percent>=40:
print('C grade')
elif percent<=39 and percent>=0:
print('D grade')
else:
print('invalid marks')
output
enter your name-agnes
enter english marks-85
enter business studies marks-70
enter accountancy marks-80
enter economics marks-65
enter informatics practices marks-95
percentange of marks= 79.0
A grade
2. cp=eval(input('enter the cost price-'))
discount=eval(input('enter the discount-'))
print('selling price=',cp-(cp*discount/100))
output
enter the cost price-1000
enter the dicount-50
selling price= 500.0
3. h=eval(input('enter height of triangle='))
a=eval(input('enter side 1 of triangle='))
b=eval(input('enter base of triangle='))
c=eval(input('enter side 2 of triangle='))
print('perimeter of triangle=',a+b+c)
print('area of triangle=',1/2*b*h)
l=eval(input('enter lenght of rectangle='))
br=eval(input('enter breadth of rectangle='))
print('perimeter of rectangle=',2*(l+br))
print('area of rectangle=',l*br)
s=eval(input('enter side of square='))
print('perimeter of square=',4*s)
print('area of square=',s**2)
r=eval(input('enter radius of circle='))
print('perimeter of circle=',2*3.14*r)
print('area of circle=',3.14*r**2)
output
enter height of triangle=3
enter side 1 of triangle=3
enter base of triangle=5
enter side 2 of triangle=4
perimeter of triangle= 12
area of triangle= 7.5
enter lenght of rectangle=7
enter breadth of rectangle=5
perimeter of rectangle= 24
area of rectangle= 35
enter side of square=4
perimeter of square= 16
area of square= 16
enter radius of circle=6
perimeter of circle= 37.68
area of circle= 113.04
4. p=eval(input('enter the principal amount='))
t=eval(input('enter the time in years='))
r=eval(input('enter the rate in percentage='))
print('simple interest=',(p*r*t)/100)
output
enter the principal amount=50000
enter the time in years=3
enter the rate in percentage=8
simple interest= 12000.0
5. cp=eval(input('enter the cost price='))
sp=eval(input('enter the selling price='))
if sp>cp:
print('profit=',sp-cp)
elif cp>sp:
print('loss=',cp-sp)
else:
print('no profit no loss')
output
enter the cost price=500
enter the selling price=750
profit= 250
6. age=eval(input('enter the age='))
if age>=18:
print('eligible for voting')
elif age<18:
print('not eligible for voting')
else:
print('invalid age')
output
enter the age=20
eligible for voting