Skip to content
Advertisement

Creating Bricks with Turtle Python

i’m very new to programming and in here i’m supposed to create a pyramid shape of bricks where the edge of the pyramid is filled with one color and the inside of it is filled with random colors, but i can’t seem to figure it out how to move the bricks to create a new row, column and the random colors specified only to inside bricks of the pyramid. Does anyone have a suggestion? Thanks in advance. This is my code and it’s still working for one brick only:

JavaScript

Advertisement

Answer

This will get you most of the way there with regards to making sure your bricks are laid out correctly:

JavaScript

Note that the fill color needs to be set inside the loop, and that’s the spot where you’ll want to randomize the color so that each brick is different. You’ll also need to be mindful of when the pen is up and when it’s down in order to avoid extra lines showing up.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement