Created
December 3, 2014 20:43
-
-
Save cotarg/3281221705e9b2afb672 to your computer and use it in GitHub Desktop.
Use turtle to draw filled polygons.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
wn = turtle.Screen() | |
sides_num = input("How many sides should this polygon have? ") | |
sides_num = int(sides_num) | |
poly_color = input("What color should the outline of this polygon be? ") | |
fill_color = input("What color should this polygon be filled in? ") | |
polly = turtle.Turtle() | |
polly.color(poly_color) | |
polly.fillcolor(fill_color) | |
polly.fill(True) | |
for i in range(sides_num): | |
polly.forward(40) | |
polly.left(360/sides_num) | |
polly.fill(False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment