Question

Use for loops to make a turtle, draw these shapes: Write a program that draws a...

Use for loops to make a turtle, draw these shapes:

  • Write a program that draws a rectangle. The rectangle should have a length and a width of 80 and 40 respectively.
  • Write a program that draws a staircase. The staircase should have four stairs, and each stair should have a height and a depth of 40.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

(1)

Code Snippet ::

Output ::

Raw Code ::

import turtle

t = turtle.Turtle()

for i in range(2):

t.forward(80) #Forward by 150 units

t.left(90) #Turn by 90 degree

t.forward(40) #Forward by 80 units

t.left(90) #Turn by 90 degree

(2)

Code Snippet :

Output :

Raw Code :

from turtle import *

x,y = 0,0 #Intial depth is x and Height is y

for i in range(4):

  goto(x,y)

  left(90) #Turn Left by 90

  x = x + 40 #Depth is 40

#Go to (x,y) x is changed to 40 after first iteration (40,0) and changes for values of x and y changes after every iteration

  goto(x,y) #goto position (x,y)

  y = y + 40 #Height is increment by 40

  right(90) #Move right by 90 degrees

Add a comment
Know the answer?
Add Answer to:
Use for loops to make a turtle, draw these shapes: Write a program that draws a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use Python 3 Create a program that uses Turtle to draw shapes. Show the following menu:...

    Use Python 3 Create a program that uses Turtle to draw shapes. Show the following menu: Enter Circle Enter Rectangle Remove Shape Draw Shapes Exit Circles – User inputs position, radius, and color. The position is the CENTER of the circle Rectangles – User inputs position, height, width, color. The position is the lower left-hand corner Colors – Allow red, yellow, blue, and green only Remove – Show the number of items in the list and let the user enter...

  • Turtle Graphics with nested loop: Write a turtle graphics python program repeat_squares.py that uses nested loops...

    Turtle Graphics with nested loop: Write a turtle graphics python program repeat_squares.py that uses nested loops to draw 100 squares, to create this design: Turtle-squares.png starting with the smallest square in the bottom right-hand corner. Start at position (-4,4). At each step increase the length of each side by 4 pixels. Draw 100 squares. Please submit with an animation speed of 0 and the turtle hidden turtle.hideturtle()

  • Use Java program Material Covered : Loops & Methods Question 1: Write a program to calculate...

    Use Java program Material Covered : Loops & Methods Question 1: Write a program to calculate rectangle area. Some requirements: 1. User Scanner to collect user input for length & width 2. The formula is area = length * width 3. You must implement methods getLength, getWidth, getArea and displayData ▪ getLength – This method should ask the user to enter the rectangle’s length and then return that value as a double ▪ getWidth – This method should ask the...

  • Write a program called draw_shapes.py. In your program, Create a block header with: your name the...

    Write a program called draw_shapes.py. In your program, Create a block header with: your name the date a short description of what the program does: Assignment 5: Draw shapes using turtle Import the turtle module. Create a window and screen (canvas) where your turtle will draw. Make the window 400 pixels wide x 400 pixels high and give it an indigo background and a title of "Shapes". Use this code to create a window object: # a place for the...

  • Use Python's Turtle Graphics module to build an original image build an image using shapes and...

    Use Python's Turtle Graphics module to build an original image build an image using shapes and colors build a repeating or abstract pattern using lines and curves ... or a combination of both! Notes: Be sure to use at least one example if not more of if/elif/else ... for and while< loops Your program must include at least three functions which you have written All of your work should be included within functions and your program should open calling main()...

  • Use Python's Turtle Graphics module to build an original image build an image using shapes and...

    Use Python's Turtle Graphics module to build an original image build an image using shapes and colors build a repeating or abstract pattern using lines and curves ... or a combination of both! Notes: Be sure to use at least one example if not more of if/elif/else ... for and while< loops Your program must include at least three functions which you have written All of your work should be included within functions and your program should open calling main()...

  • Using Python Write the following well-documented (commented) program. Create a class called Shape that has a...

    Using Python Write the following well-documented (commented) program. Create a class called Shape that has a method for printing the area and the perimeter. Create three classes (Square, Rectangle, and Circle) which inherit from it. Square will have one instance variable for the length. Rectangle will have two instance variables for the width and height. Circle will have one instance variable for the radius. The three classes will have methods for computing the area and perimeter of its corresponding shape....

  • Using C++, Write a program that will provide the user a menu from which the user...

    Using C++, Write a program that will provide the user a menu from which the user may select to calculate the area of one of four geometric shapes: a circle, a rectangle, a triangle, and a trapezoid. You should use the most appropriate SWITCH block for this program. The user will input all data needed to calculate the area. The program should output all data input by the user, the calculated area, and the geometric shape selected. Run this program...

  • In python use draw turtle to draw 2 different shapes that look visually appealing and here...

    In python use draw turtle to draw 2 different shapes that look visually appealing and here are the criteria: -Must have have a function and a for loop in that function -and also have a while loop outside the function that calls the function. -and also have the user be able to input how many of the shapes he want such as the example below num_of_rectangles_and_square = int(input('how many rectangles and squares would you like drawn?'))

  • Using Python, please write a program that draws the following shapes using turtles and tkinter: Tetrahedron...

    Using Python, please write a program that draws the following shapes using turtles and tkinter: Tetrahedron Cube Octahedron Dodecahedron Icosahedron Please make sure they're drawn out using only lines in the 2D dimension. All the shapes need to be in the same window. No need to color them. Thank you.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT