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()

============================================================================== This code draws hexagon but I need a color list and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!