Practical No. 5
Practical No. 5
Q.1
Write a Python program to draw a polygon with vertices (0,0), (2,0), (2,3), and
(1,6) and rotate it by 180°
In [13]:
print(p.rotate(pi))
Q.2
In [32]:
print(p.rotate(pi/2))
Write a Python program to find the area and perimeter of the ∆ABC, where
A[0,0], B[6,0], and C[4,4].
In [16]:
Q.4
Using Python, draw a regular polygon with 6 sides and radius 1 centered at
(1,2) and find its area and perimeter.
In [19]:
Perimeter of Polygon is : 6
Area of Polygon is : 3*sqrt(3)/2
Q.5
Write a Python program to plot the rectangle with vertices at [2,1], [2,4] [5,4],
[5,1] and its uniform expansion by factor 4.
In [28]:
Q.6
Generate a triangle with vertices (0,0), (4,0), and (1,4), and check whether the
triangle is a Scalene triangle.
In [31]:
print(p.is_scalene())
True
In [35]:
print(p.angles[A])
print(p.angles[B])
print(p.angles[C]) # Note - here we used sqaure bracket for angles
acos(4/5)
pi/2
acos(3/5)