Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You will use Turtle graphics to draw a picture containing multiple shapes of mul

ID: 662681 • Letter: Y

Question

You will use Turtle graphics to draw a picture containing multiple shapes of multiple colors and arranged to be visually pleasing. Although you are free to decide the precise shape(s) and layout for your picture, some aspect of the picture must depend on a numeric value input by the user. For example, the input might determine the size of the shapes, the number of shapes, or their spacing.

Project Description / Specification: Your program must: 1. Output a brief descriptive message of what the program does. 2. Repeatedly prompt for the input until the user supplies values of the correct form (discard incorrect inputs). Your prompt should say what form of input is needed. 3. Draw a picture containing multiple shapes of multiple colors, where the input value(s) is (are) used to determine some aspect of the shapes and/or their layout.

In programming your solution, you must: 1. Use at least two repetition (while or for) statements. 2. Use at least one selection (if) statement.

We show example output produced by two different programs that meet these requirements at the end of this write-up. You may be creative and create your own program, or you may choose to mimic one of these two examples. The second example shows error checking being tested.

Explanation / Answer

import turtle import random def block(x, y, color, windows): turtle.penup() turtle.goto(x, y) turtle.pendown() turtle.setheading(0) turtle.fillcolor(color, color, color) turtle.begin_fill() for i in range(4): turtle.forward(50) turtle.right(90) turtle.end_fill() if windows: turtle.fillcolor(1,1,1) turtle.penup() turtle.goto(x+10, y-10) turtle.pendown() print(x+10, y-10) turtle.begin_fill() for i in range(2): turtle.forward(30) turtle.right(90) turtle.forward(10) turtle.right(90) turtle.end_fill() xpos = -200; ypos = -200; blocksize = int(turtle.textinput("Title Window", "Enter the block size")) for building in range(5): stories = random.randint(1, 10) for story in range(stories): if (random.randint(1,2) == 1): windows = True else: windows = False block(xpos, ypos, random.random(), windows) ypos += blocksize ypos = -200 xpos += blocksize

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote