[SOLVED] Draw Co-ordinates using Turtle

Issue

I’m trying to draw a set of co-ordinates using Python Turtle, however ,I’m stuck and have no clue how to move on.

def generate_map(x_range, y_range, locations):
    generated_map = []

    for x in range(locations):
        generated_map.append([random.randint(x_range, y_range), random.randint(x_range, y_range)])


    return generated_map

 new_generated_map = generate_map(-20,20,10)
 print("The co-ordinates are:",new_generated_map)

def print_map(speed, color, thickness, selected_map):
    print("printing map")


    turtle.speed(3)
    turtle.pencolor("black")
    turtle.pensize(4)


    for locations in (new_generated_map):
        turtle.pendown()

I know that I have to set up a loop function but I’m not sure how to write it out, still new to programming.

Solution

Add this to the loop in print_map:

turtle.goto(locations)

Answered By – norie

Answer Checked By – Candace Johnson (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published.