- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Check if it is possible to create a polygon with a given angle in Python

Suppose we have an angle a. We have to check whether we can make a regular polygon where all angles are same as a or not.

So, if the input is like a = 120, then the output will be True the pentagon has all angles same as 120°. As we know

$$Interior Angle(a)=\frac{180\times(n-2)}{n}\begin{bmatrix} n=number of sides of polygon\end{bmatrix}$$ $$¿n=\frac{360}{180-a}$$

So if n is integer then this is forming a regular polygon.

To solve this, we will follow these steps −

- sides := 360 /(180 - a)
- if sides has no fractional part, then
- return True

- return False

## Example

Let us see the following implementation to get better understanding −

def solve(a) : sides = 360 / (180 - a) if sides == int(sides) : return True return False a = 120 print (solve(a))

## Input

120

## Output

True

- Related Questions & Answers
- Check if it is possible to create a polygon with given n sidess in Python
- Check if it is possible to create a palindrome string from given N in Python
- Check if it is possible to draw a straight line with the given direction cosines in Python
- Check if a given point lies inside a Polygon
- Check if it is possible to convert one string into another with given constraints in Python
- Check if it is possible to form string B from A under the given constraint in Python
- Check if it is possible to survive on Island in Python
- Check if it is possible to reach a number by making jumps of two given length in Python
- Check if a triangle of positive area is possible with the given angles in Python
- Check if it is possible to rearrange a binary string with alternate 0s and 1s in Python
- Check if it is possible to serve customer queue with different notes in Python
- Check if is possible to get given sum from a given set of elements in Python
- Check if it is possible to sort the array after rotating it in Python
- Is it possible in Android to check if a notification is visible or canceled?
- Is it possible to check if a String only contains ASCII in java?

Advertisements