```
import turtle
from turtle import Turtle, Screen
import random
turtle.colormode(255)
color_list = [(248, 226, 239), (233, 172, 54), (242, 236, 225), (236, 240, 247), (43, 122, 154), (231, 244, 238)]
t = Turtle()
t.dot(20, (255,255,255))
t.setheading(220)
t.penup()
t.forward(300)
t.pendown()
t.setheading(1)
```

function that has a method to make the polkabots go in a line.

```
def polkadot():
for times in range(9):
t.dot(40, random.choice(color_list))
t.speed("slow")
t.forward(50)
t.dot(40, random.choice(color_list))
```

function that helps the turtle to go left when above function ends.

```
def dotmoveleft():
t.setheading(90)
t.penup()
t.forward(50)
t.pendown()
```

`t.setheading(180) function that helps the turtle to go rightwhen above function ends.`

```
def dotmoveright():
t.setheading(90)
t.penup()
t.forward(50)
t.pendown()
t.setheading(0)
```

function that helps the above methods to coninue for limited(given)

range

```
for a in range(int(5)):
polkadot()
dotmoveleft()
polkadot()
dotmoveright()
screen=turtle.Screen()
screen.exitonclick()
```

this exercise has been extrated from Angela Yu tuturial and in the

solution turtorial she metioned a more compact and diffrent approach

whereas i did mine differently. i am totally newbie to coding hence

could not do it in any short method.any suggestion is welcome.Thanks

for reading through so far.

Source: Python-3x Questions