Question: ============================================================================== This code draws hexagon but I need a color list and use this color list in coloring the hexagons: =============================================================================== import turtle t =
==============================================================================
This code draws hexagon but I need a color list and use this color list in coloring the hexagons:
===============================================================================
import turtle
t = turtle.Turtle()
angle = 60 # hexagons
#create hexagons
def drawHex():
t.pendown()
t.right(angle)
t.backward(50)
t.right(angle)
t.backward(50)
t.right(angle)
t.backward(50)
t.right(angle)
t.backward(50)
t.right(angle)
t.backward(50)
t.right(angle)
t.backward(50)
t.penup()
# draw the upper shapes
for col, y in ('red', 0.0), ('blue', -25.0),('brown', -50.0):
t.color(col)
t.sety(y)
drawHex()
#draw circles
t.color('black')
t.fillcolor('black')
t.setx(15.0)
t.sety(35)
t.pendown()
t.begin_fill()
t.circle(3)
t.end_fill()
t.penup()
t.setx(30.0)
t.pendown()
t.begin_fill()
t.circle(3)
t.end_fill()
t.penup()
t.setx(0.0)
t.sety(0.0)
#draw the bottom shapes
for col, y in ('green', -150.0), ('yellow', -200.0):
t.color(col)
t.sety(y)
drawHex()

Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
