0% found this document useful (0 votes)
13 views2 pages

Assignment Python

Uploaded by

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

Assignment Python

Uploaded by

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

In [ ]: #find the area of rectangle .

In [3]: l=int(input("enter the length of rectangle"))


w=int(input("enter the width of rectangle"))
ar=l*w
print("area of rectangle is:",ar)

area of rectangle is: 80

In [ ]: #find area of cuboid: TSA

In [3]: l=int(input("enter the length of cuboid"))


w=int(input("enter the width of cuboid"))
h=float(input("enter the height of cuboid"))
TSA = 2*(l*w + w*h + l*h) #TSA=total surface area
print("area of cuboid is:",TSA)

area of cuboid is: 700.0

In [ ]: #write a program to calculate area of triangle

In [ ]: bse=int(input("enter the base of triangle"))


hgt=int(input("enter the height of triangle"))
ar=(1/2)*(bse*hgt)
print("area of triangle is:",ar)

In [ ]: #write a program to calculate area of square

In [11]: s=int(input("enter the side of square:"))


ar=s*s
print("area of square:",ar)

area of square: 49

In [ ]: #write a program to calculate the volume of cuboid

In [15]: l=int(input("enter the length of cuboid"))


w=int(input("enter the width of cuboid"))
h=float(input("enter the height of cuboid"))
vol=l*w*h
print("volume of cuboid is:",vol)

volume of cuboid is: 375.0

In [ ]: #write a program to calculate the area of cube

In [5]: sl=int(input("enter the side length of cube:"))


ar=6*(sl*sl)
print("area of cube:",ar)

area of cube: 150

In [ ]: # find the area of cylinder . pi=3.14

In [11]: r=float(input("enter radius for the cylinder"))


h=float(input("enter the height of cylinder"))
π=3.14 #pi=3.14
TSA = (2*π*r*r) + (2*π*r*h) #TSA=total surface area
print("area of cylinder:",TSA)

area of cylinder: 94.2

In [ ]: #find the area of conic

In [15]: pi=3.14
r=float(input("enter radius for the cone"))
l=float(input("enter the slant height of cone"))
TSA=pi*r*(l+r) #TSA=total surface area
print("area of cone:",TSA)

area of cone: 266.90000000000003

In [23]: #area of circle


pi=3.14
r=float(input("enter radius of circle"))
ar=pi*r**2
print("area of circle:",ar)

area of circle: 78.5

In [ ]: #perimeter of circle

In [25]: pi=3.14
r=float(input("enter radius of circle"))
peri=2*pi*r
print("perimeter of circle:",peri)

perimeter of circle: 31.400000000000002


In [27]: # find the perimeter of square .
s=int(input("enter the side of square:"))
peri=4*s
print("perimeter of square:",peri)

perimeter of square: 40

You might also like