Python Code To Write in Practical Record
Python Code To Write in 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.)
#Grade A-->if mark>=80, Grade B-->mark>=60 and <80, Grade C-->mark>=50 and <60
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"
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 (%).
sp = cp - da #Selling Price
#and circle.
import math
ch = int(input('''\t1.Triangle
\t2.Rectangle
\t3.Square
\t4.Circle'''))
if ch==1:
p = a+b+c #Perimeter
area = math.sqrt(s*(s-a)*(s-b)*(s-c))
elif ch==2:
p = 2 * (l + b) #Perimeter
area = l * b #Area
elif ch==3:
p = 4*a #Perimeter
area = a * a #Area
elif ch == 4:
r = float(input("Enter the Radius of the Cricle : "))
p = 2 * math.pi * r
else:
print("Invalid Selection")
import math
ch = int(input('''\t1.Simple Interest
\t2.Compound Interest'''))
if ch==1:
ta = p + si #Total Amount
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")
d = sp - cp
if d>0:
elif d<0:
else:
#Grade A-->if mark>=80, Grade B-->mark>=60 and <80, Grade C-->mark>=50 and <60
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"
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 (%).
sp = cp - da #Selling Price
#and circle.
import math
ch = int(input('''\t1.Triangle
\t2.Rectangle
\t3.Square
\t4.Circle'''))
if ch==1:
p = a+b+c #Perimeter
area = math.sqrt(s*(s-a)*(s-b)*(s-c))
elif ch==2:
p = 2 * (l + b) #Perimeter
area = l * b #Area
elif ch==3:
p = 4*a #Perimeter
area = a * a #Area
p = 2 * math.pi * r
else:
print("Invalid Selection")
import math
ch = int(input('''\t1.Simple Interest
\t2.Compound Interest'''))
if ch==1:
ta = p + si #Total Amount
elif ch==2:
x = 1+(r/100)
ta = p*math.pow(x,t)
intrst = ta - p
else:
print("Invalid Choice")
d = sp - cp
if d>0:
elif d<0:
else:
#Grade A-->if mark>=80, Grade B-->mark>=60 and <80, Grade C-->mark>=50 and <60
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"
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 (%).
sp = cp - da #Selling Price
#and circle.
import math
ch = int(input('''\t1.Triangle
\t2.Rectangle
\t3.Square
\t4.Circle'''))
if ch==1:
p = a+b+c #Perimeter
area = math.sqrt(s*(s-a)*(s-b)*(s-c))
elif ch==2:
p = 2 * (l + b) #Perimeter
area = l * b #Area
elif ch==3:
p = 4*a #Perimeter
area = a * a #Area
print("The Perimeter and Area of Given Square are : ",p,area)
elif ch == 4:
p = 2 * math.pi * r
else:
print("Invalid Selection")
import math
ch = int(input('''\t1.Simple Interest
\t2.Compound Interest'''))
if ch==1:
ta = p + si #Total Amount
elif ch==2:
x = 1+(r/100)
ta = p*math.pow(x,t)
intrst = ta - p
else:
print("Invalid Choice")
d = sp - cp
if d>0:
elif d<0:
else:
******The End******