Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions MakeThePolygon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import turtle


#Gets the user's input(sides of the polygon) then calculates the value of the internal angle of the shape
sides_number = int(input("Number of sides:"))
internal_angules = ((sides_number-2)*180)/sides_number

#Length of the line
proportion = 500/sides_number

#Opens the window
window = turtle.Screen()

#Creates the object instance(arrow) for draw and changes it's line width
arrow = turtle.Turtle()
arrow.pensize(3)

#Draws the regular polygon and fills it
arrow.begin_fill()

for x in range(sides_number):
arrow.forward(proportion)
arrow.right(180-internal_angules)

arrow.end_fill()


print("Click on the screen to close it")
window.exitonclick()

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Thanks!
| temperature_table.py | Prints a table of fahrenheit and Celsius values | [Eventhisone](https://github.com/eventhisone)
| [calculatePi.py](https://github.com/accakks/Simple-Programs-in-Python/blob/master/calculatePi.py) | Calculates PI to a specified number of digits of accuracy. | [Joseph-Acevedo](https://github.com/joseph-acevedo) |
| [mp3_duration.py](https://github.com/srbilla/Simple-Programs-in-Python/blob/master/mp3_duration.py) | Returns the duration of mp3 file | [Santhosh](https://github.com/srbilla) |
| [MakeThePolygon.py](--) | Construct a regular polygon based on user's input | [IfYouThenTrue](https://github.com/IfYouThenTrue) |
[sixers.py](https://github.com/accakks/Simple-Programs-in-Python/blob/master/sixers.py) | Calculates number of days until the next 76ers game this month | [Sabrina Koehler](https://github.com/sabrinakoehler)|
|koch_snowflake.py | Draw a Koch snowflake fractal with Turtle module | [Lenart Bucar](https://github.com/LenartBucar)
|Quine.py | Quine of python | [Xiao Tan](https://github.com/tvytlx)
Expand Down