0% found this document useful (0 votes)
9 views3 pages

NMPR 8

This document presents a practical assignment in Python programming focused on representing polygons. It includes tasks such as calculating the area and perimeter of various polygons, rotating them, and checking triangle properties using Python code. The practical is designed for a mathematics course and includes specific examples with code snippets and outputs.

Uploaded by

vishalkhokrale65
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)
9 views3 pages

NMPR 8

This document presents a practical assignment in Python programming focused on representing polygons. It includes tasks such as calculating the area and perimeter of various polygons, rotating them, and checking triangle properties using Python code. The practical is designed for a mathematics course and includes specific examples with code snippets and outputs.

Uploaded by

vishalkhokrale65
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/ 3

Practical No.

8
Name: Khokrale Vishal Vikas
Class:S.Y.B.Sc(Computer Science)
Div:B
Roll No:40 Batch:D
Subject:MTC-243 Mathematics Practical: Python programing language II
Practical Name: Representing Polygon in Python.
Date:04/03/2025

Que.1) Draw a Polygon with vertices (0,0), (1,0), (2,2), (1,4) then find its Area and
Perimeter.
Ans.
>>>from math import*
>>>from sympy import*
>>>A=Point(0,0)
>>>B=Point(1,0)
>>>C=Point(2,2)
>>>D=Point(1,4)
>>>p=Polygon(A,B,C,D)
>>>p.area
4
>>>p.perimeter
1 + sqrt(17) + 2*sqrt(5)

Que.2) Draw a regular polygon with 6 vertices side and radius one centred at (1,2). find
its Area and Perimeter.
Ans.
>>>from math import*
>>>from sympy import*
>>>p=Polygon((1,2),1,n=6)
>>>p.area
3*sqrt(3)/2
>>>p.perimeter
6

Que.3) Write a python program to draw a polygon with vertices (0,0), (2,0), (2,3), (1,6)
and rotate by 𝟏𝟖𝟎𝟎 .
Ans.
>>>from math import*
>>>from sympy import*
>>>A=Point(0,0)
>>>B=Point(2,0)
>>>C=Point(2,3)
>>>D=Point(1,6)
>>>p=Polygon(A,B,C,D)
>>>p.rotate(radians(180))
Polygon(Point2D(0, 0), Point2D(-2, 244929359829471/1000000000000000000000000000000),
Point2D(-2, -3), Point2D(-1, -6))

Que.4) Using python generate triangle with vertices (0,0), (4,0), (4,3). Check whether the
triangle is right angle triangle or isosceles triangle.
Ans.
>>>from math import*
>>>from sympy import*
>>>A=Point(0,0)
>>>B=Point(4,0)
>>>C=Point(4,3)
>>>p=Polygon(A,B,C)
>>>p.is_right()
True
>>>p.is_isosceles()
False
Que.5) write a python program to rotate the triangle ABC by 𝟗𝟎𝟎 .Where A (1,1),
B (2,-2), C (1,2).
Ans.
>>>from math import*
>>>from sympy import*
>>>A=Point(1,1)
>>>B=Point(2,-2)
>>>C=Point(1,2)
>>>p=Polygon(A,B,C)
>>>p.rotate(radians(90))
Triangle(Point2D(-1, 1), Point2D(2, 2), Point2D(-2, 1))

You might also like