0% found this document useful (0 votes)
138 views16 pages

Python Code To Write in Practical Record

Uploaded by

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

Python Code To Write in Practical Record

Uploaded by

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

CLASS XI – IP PROGRAMS TO WRITE IN THE PRACTICAL RECORD

ORDER OF WRITING
On Right Page
Write Program No. and Question
Then from next line onwards, write code. (Write only single statement in each line.)

On Left page
OUTPUT:
Write Output

(Execute the codes given below, check the output and write in record book.)

Program 1: To find average and grade for given marks


#Program to find average and grade for marks in 3 Exams.

#Each mark is out of 100.Find average

#Grade A-->if mark>=80, Grade B-->mark>=60 and <80, Grade C-->mark>=50 and <60

#Grade D-->if mark>=35 and <50, Grade F--> mark<35

m1 = int(input("Enter mark 1(out of 100) : "))

m2 = int(input("Enter mark 2(out of 100) : "))

m3 = int(input("Enter mark 3(out of 100) : "))

avg = (m1+m2+m3)/3

if avg>=80:

grade = "A"

elif avg>=60:

grade = "B"

elif avg>=50:

grade = "C"

elif avg>=35:
grade = "D"

else:

avg = "F"

print("The Average is ",avg,"and the Grade is ",grade)

Program 2 : To find sale price of an item with given cost and discount (%).
#To find sale price of an item with given cost and discount (%).

cp = float(input("Enter the cost Price : "))

dp = float(input("Enter the Discount Percentage : "))

da = cp*dp/100 #Discount Amount

sp = cp - da #Selling Price

print("The Discount amount is ",da)

print("The Selling Price is ",sp)


Program 3 : To calculate perimeter/circumference and area of shapes such as triangle,
rectangle, square and circle.
#To calculate perimeter/circumference and area of triangle, rectangle, square

#and circle.

import math

print("Select your choice")

ch = int(input('''\t1.Triangle

\t2.Rectangle

\t3.Square

\t4.Circle'''))

if ch==1:

a = int(input("Enter length of Side 1 :"))

b = int(input("Enter length of Side 2 :"))

c = int(input("Enter length of Side 3 :"))

p = a+b+c #Perimeter

s =p/2 #Semi Perimeter

area = math.sqrt(s*(s-a)*(s-b)*(s-c))

print("The Perimeter and Area of Given Triangle are : ",p,area)

elif ch==2:

l = float(input("Enter the length of Rectangle : "))

b = float(input("Enter the Breadth of Rectangle : "))

p = 2 * (l + b) #Perimeter

area = l * b #Area

print("The Perimeter and Area of Given Rectangle are : ",p,area)

elif ch==3:

a = float(input("Enter length of the side : "))

p = 4*a #Perimeter

area = a * a #Area

print("The Perimeter and Area of Given Square are : ",p,area)

elif ch == 4:
r = float(input("Enter the Radius of the Cricle : "))

p = 2 * math.pi * r

area = math.pi * math.pow(r,2)

print("The Perimeter and Area of Given Circle are : ",p,area)

else:

print("Invalid Selection")

Program 4 : To calculate Simple and Compound interest.


#To calculate Simple and Compound interest.

import math

p = float(input("Enter the Principal Amount : "))

t = int(input("Enter the Time Period : "))

r = float(input("Enter the Rate of Interest : "))

print("Enter your Choice : ")

ch = int(input('''\t1.Simple Interest

\t2.Compound Interest'''))

if ch==1:

si = (p*r*t)/100 #Simple Interest

ta = p + si #Total Amount

print("The Simple Interest is ",si,"and the Total Amount is ",ta)

elif ch==2:

x = 1+(r/100)

ta = p*math.pow(x,t)

intrst = ta - p
print("The Total Amount is ",ta,"and the Compound Interest is ",intrst)

else:

print("Invalid Choice")

(For your understanding, not to write in record book)


Program 5 : To calculate profit-loss for given Cost and Sell Price.
#To calculate profit-loss for given Cost and Sell Price.

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

sp = float(input("Enter the Sell Price : "))

d = sp - cp

if d>0:

print("The Profit is ",d)

elif d<0:

print("The Loss is ",d)

else:

print("No Profit No Loss")

Program 1: To find average and grade for given marks


#Program to find average and grade for marks in 3 Exams.

#Each mark is out of 100.Find average

#Grade A-->if mark>=80, Grade B-->mark>=60 and <80, Grade C-->mark>=50 and <60

#Grade D-->if mark>=35 and <50, Grade F--> mark<35

m1 = int(input("Enter mark 1(out of 100) : "))

m2 = int(input("Enter mark 2(out of 100) : "))

m3 = int(input("Enter mark 3(out of 100) : "))

avg = (m1+m2+m3)/3

if avg>=80:

grade = "A"

elif avg>=60:

grade = "B"

elif avg>=50:

grade = "C"
elif avg>=35:

grade = "D"

else:

avg = "F"

print("The Average is ",avg,"and the Grade is ",grade)

Program 2 : To find sale price of an item with given cost and discount (%).
#To find sale price of an item with given cost and discount (%).

cp = float(input("Enter the cost Price : "))

dp = float(input("Enter the Discount Percentage : "))

da = cp*dp/100 #Discount Amount

sp = cp - da #Selling Price

print("The Discount amount is ",da)

print("The Selling Price is ",sp)


Program 3 : To calculate perimeter/circumference and area of shapes such as triangle,
rectangle, square and circle.
#To calculate perimeter/circumference and area of triangle, rectangle, square

#and circle.

import math

print("Select your choice")

ch = int(input('''\t1.Triangle

\t2.Rectangle

\t3.Square

\t4.Circle'''))

if ch==1:

a = int(input("Enter length of Side 1 :"))

b = int(input("Enter length of Side 2 :"))

c = int(input("Enter length of Side 3 :"))

p = a+b+c #Perimeter

s =p/2 #Semi Perimeter

area = math.sqrt(s*(s-a)*(s-b)*(s-c))

print("The Perimeter and Area of Given Triangle are : ",p,area)

elif ch==2:

l = float(input("Enter the length of Rectangle : "))

b = float(input("Enter the Breadth of Rectangle : "))

p = 2 * (l + b) #Perimeter

area = l * b #Area

print("The Perimeter and Area of Given Rectangle are : ",p,area)

elif ch==3:

a = float(input("Enter length of the side : "))

p = 4*a #Perimeter

area = a * a #Area

print("The Perimeter and Area of Given Square are : ",p,area)


elif ch == 4:

r = float(input("Enter the Radius of the Cricle : "))

p = 2 * math.pi * r

area = math.pi * math.pow(r,2)

print("The Perimeter and Area of Given Circle are : ",p,area)

else:

print("Invalid Selection")

Program 4 : To calculate Simple and Compound interest.


#To calculate Simple and Compound interest.

import math

p = float(input("Enter the Principal Amount : "))

t = int(input("Enter the Time Period : "))

r = float(input("Enter the Rate of Interest : "))

print("Enter your Choice : ")

ch = int(input('''\t1.Simple Interest

\t2.Compound Interest'''))

if ch==1:

si = (p*r*t)/100 #Simple Interest

ta = p + si #Total Amount

print("The Simple Interest is ",si,"and the Total Amount is ",ta)

elif ch==2:

x = 1+(r/100)

ta = p*math.pow(x,t)
intrst = ta - p

print("The Total Amount is ",ta,"and the Compound Interest is ",intrst)

else:

print("Invalid Choice")

(For your understanding, not to write in record book)


Program 5 : To calculate profit-loss for given Cost and Sell Price.
#To calculate profit-loss for given Cost and Sell Price.

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

sp = float(input("Enter the Sell Price : "))

d = sp - cp

if d>0:

print("The Profit is ",d)

elif d<0:

print("The Loss is ",d)

else:

print("No Profit No Loss")

Program 1: To find average and grade for given marks


#Program to find average and grade for marks in 3 Exams.

#Each mark is out of 100.Find average

#Grade A-->if mark>=80, Grade B-->mark>=60 and <80, Grade C-->mark>=50 and <60

#Grade D-->if mark>=35 and <50, Grade F--> mark<35

m1 = int(input("Enter mark 1(out of 100) : "))

m2 = int(input("Enter mark 2(out of 100) : "))

m3 = int(input("Enter mark 3(out of 100) : "))

avg = (m1+m2+m3)/3

if avg>=80:

grade = "A"

elif avg>=60:

grade = "B"

elif avg>=50:
grade = "C"

elif avg>=35:

grade = "D"

else:

avg = "F"

print("The Average is ",avg,"and the Grade is ",grade)

Program 2 : To find sale price of an item with given cost and discount (%).
#To find sale price of an item with given cost and discount (%).

cp = float(input("Enter the cost Price : "))

dp = float(input("Enter the Discount Percentage : "))

da = cp*dp/100 #Discount Amount

sp = cp - da #Selling Price

print("The Discount amount is ",da)

print("The Selling Price is ",sp)


Program 3 : To calculate perimeter/circumference and area of shapes such as triangle,
rectangle, square and circle.
#To calculate perimeter/circumference and area of triangle, rectangle, square

#and circle.

import math

print("Select your choice")

ch = int(input('''\t1.Triangle

\t2.Rectangle

\t3.Square

\t4.Circle'''))

if ch==1:

a = int(input("Enter length of Side 1 :"))

b = int(input("Enter length of Side 2 :"))

c = int(input("Enter length of Side 3 :"))

p = a+b+c #Perimeter

s =p/2 #Semi Perimeter

area = math.sqrt(s*(s-a)*(s-b)*(s-c))

print("The Perimeter and Area of Given Triangle are : ",p,area)

elif ch==2:

l = float(input("Enter the length of Rectangle : "))

b = float(input("Enter the Breadth of Rectangle : "))

p = 2 * (l + b) #Perimeter

area = l * b #Area

print("The Perimeter and Area of Given Rectangle are : ",p,area)

elif ch==3:

a = float(input("Enter length of the side : "))

p = 4*a #Perimeter

area = a * a #Area
print("The Perimeter and Area of Given Square are : ",p,area)

elif ch == 4:

r = float(input("Enter the Radius of the Cricle : "))

p = 2 * math.pi * r

area = math.pi * math.pow(r,2)

print("The Perimeter and Area of Given Circle are : ",p,area)

else:

print("Invalid Selection")

Program 4 : To calculate Simple and Compound interest.


#To calculate Simple and Compound interest.

import math

p = float(input("Enter the Principal Amount : "))

t = int(input("Enter the Time Period : "))

r = float(input("Enter the Rate of Interest : "))

print("Enter your Choice : ")

ch = int(input('''\t1.Simple Interest

\t2.Compound Interest'''))

if ch==1:

si = (p*r*t)/100 #Simple Interest

ta = p + si #Total Amount

print("The Simple Interest is ",si,"and the Total Amount is ",ta)

elif ch==2:

x = 1+(r/100)
ta = p*math.pow(x,t)

intrst = ta - p

print("The Total Amount is ",ta,"and the Compound Interest is ",intrst)

else:

print("Invalid Choice")

(For your understanding, not to write in record book)


Program 5 : To calculate profit-loss for given Cost and Sell Price.
#To calculate profit-loss for given Cost and Sell Price.

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

sp = float(input("Enter the Sell Price : "))

d = sp - cp

if d>0:

print("The Profit is ",d)

elif d<0:

print("The Loss is ",d)

else:

print("No Profit No Los s")

******The End******

You might also like