Python Programs
Class XI
# amount calculation for given cost-qty-discount
pname=input("Enter Product name:")
cost=int(input("Enter cost:"))
qty=int(input("Enter qty:"))
amt=cost*qty
print("Amount is:", amt)
dis=amt*10/100
print("Discount is", dis)
np=amt-dis
print("Net Price",np)
# perimeter-wise/area-wise cost calculation
len=int(input("Enter Length in mtrs:"))
wid=int(input("Enter width in mtrs:"))
com=float(input("Enter cost of material per mtr square:"))
area=len*wid
peri=2*(len+wid)
print("Area is:", area)
print("Perimeter is:", peri)
tcost=area*com
print("Total cost of flooring is:", tcost)
# Interest Calculation
p = int(input("Enter Principal:"))
r = float(input("Enter Rate:"))
t = int(input("Enter Time:"))
si=0.0
si=(p*r*t)/100
print("Simple Interest is:", si)
# EMI Calculator
loan=int(input("Enter loan amount:"))
interest=float(input("Enter interest (%p.a):"))
time=float(input("Enter time (in years)"))
amt=loan+(loan*interest*time)/100
emi=amt/(time*12)
print("Emi is:", emi)
# GST calculation
#GST Amount = (GST x Original cost of the product or service) / 100
#Net Price = Original cost of the product or service + GST amount
pname=input("Enter product name:")
price=int(input("Enter cost of product:"))
gst=price*18/100
np=price+gst
print("Product name:",pname)
print("Price:",price)
print("GST:",gst)
print("Net Price:",np)
# profit loss
cp=int(input("Enter cost price:"))
sp=int(input("Enter selling price:"))
if(sp>cp):
print("Profit is:", sp-cp)
else:
print("Loss is:", cp-sp)
# Calculate Average and Grade of marks input
m1=int(input("Enter Marks1:"))
m2=int(input("Enter Marks1:"))
m3=int(input("Enter Marks1:"))
total=m1+m2+m3
avg=total/3
print("Total is:", total)
print("Average is:", avg)
if(avg>=90):
print("Grade is A")
elif(avg>=60):
print("Grade is B")
else:
print("Grade is C")
# Calculate Income Tax
msal=int(input("Enter monthly salary="))
yrlinc=msal*12
if(yrlinc<=250000):
tax=0
else:
tax=(yrlinc-250000)*10/100
print("Yearly salary is Rs:",yrlinc)
print("Tax to be paid is Rs:",tax)