From 22ea14a64b5ef022c59847aec723accc6825ca89 Mon Sep 17 00:00:00 2001 From: Jean Michel Furtado M'Peko Date: Wed, 30 Oct 2019 18:13:17 -0300 Subject: [PATCH 1/2] added MakeThePolygon.py --- MakeThePolygon.py | 30 ++++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 31 insertions(+) create mode 100644 MakeThePolygon.py diff --git a/MakeThePolygon.py b/MakeThePolygon.py new file mode 100644 index 0000000..87b1d9c --- /dev/null +++ b/MakeThePolygon.py @@ -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() + diff --git a/README.md b/README.md index e052e20..caa165c 100644 --- a/README.md +++ b/README.md @@ -37,3 +37,4 @@ Thanks! |positive_word.py | Get a positive word | [shopro](https://github.com/shopro) |CovertDecimaltoBin._Octal_Hexadecimal.py | To convert decimal value into octal,binary and hexadecimal | [Akshay Kumar](https://github.com/GHakshay) | [KaprekarsConstant.py](https://github.com/accakks/Simple-Programs-in-Python/blob/master/KaprekarsConstant.py) | Returns the number of times this routine must be performed until 6174 is reached. | [Emanuel H](https://github.com/Emanuelh77) | +| [MakeThePolygon.py](--) | Construct a regular polygon based on user's input | [IfYouThenTrue](https://github.com/IfYouThenTrue) | From 4496bfd089eeee7bc0787bf0fa8d249b1b187462 Mon Sep 17 00:00:00 2001 From: Jean Michel Furtado M'Peko Date: Wed, 30 Oct 2019 18:14:46 -0300 Subject: [PATCH 2/2] added MakeThePolygon.py --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index caa165c..9fd71d1 100644 --- a/README.md +++ b/README.md @@ -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) @@ -37,4 +38,3 @@ Thanks! |positive_word.py | Get a positive word | [shopro](https://github.com/shopro) |CovertDecimaltoBin._Octal_Hexadecimal.py | To convert decimal value into octal,binary and hexadecimal | [Akshay Kumar](https://github.com/GHakshay) | [KaprekarsConstant.py](https://github.com/accakks/Simple-Programs-in-Python/blob/master/KaprekarsConstant.py) | Returns the number of times this routine must be performed until 6174 is reached. | [Emanuel H](https://github.com/Emanuelh77) | -| [MakeThePolygon.py](--) | Construct a regular polygon based on user's input | [IfYouThenTrue](https://github.com/IfYouThenTrue) |