Join the Dots Challenge

To complete this challenge, your task is to connect the 9 dots below using just 4 connected straight lines (without lifting your pen!).

Grab a piece of paper and have a go.

Alternatively, you can draw and connect the 9 dots on this online whiteboard:

Python Turtle Challenge


Did you manage to connect the 9 dots in just 4 straight lines, without lifting your pen? If so you are now going to write an algorithm using Python Turtle for the computer to solve this challenge by following the instructions of your algorithm. To do so we will use (x,y) coordinates. The canvas we are drawing on (using Python Turtle) is 400 pixels wide by 400 pixels high. The coordinates (0,0) refers to the centre of the cnavas.

xy-coordinates

Look at the canvas below to understand how (x,y) coordinates work:

In order to draw on screen, we will use the goto() instruction from the turtle library. This instruction takes two parameters: the x,y coordinates of where the pen should travel to:

pen.goto(50,150)

Complete the code…

We have started the code for you. Your task is to add a few goto() instructions for the computer to solve this challenge challenge!

Did you like this challenge?

Click on a star to rate it!

Average rating 3.3 / 5. Vote count: 78

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: