Question

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?'))

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import turtle

def drawSquare(t, side):

t.penup()

t.goto(100, 100)

t.pendown()

for i in range(4):

t.forward(side)

t.left(90)

def drawRectangle(t, length, width):

t.penup()

t.goto(-200, -200)

t.pendown()

for i in range(2):

t.forward(length)

t.left(90)

t.forward(width)

t.left(90)

num_of_rectangles_and_square = int(input('how many rectangles and squares would you like drawn?'))

i = 0

t = turtle.Turtle()

while i < num_of_rectangles_and_square:

drawSquare(t, 100 + 10*i)

drawRectangle(t, 150 + 10*i, 80 + 10 * i)

i += 1

Add a comment
Know the answer?
Add Answer to:
In python use draw turtle to draw 2 different shapes that look visually appealing and here...
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...

  • I need help with this code, I have it started here import sys import turtle menu...

    I need help with this code, I have it started here import sys import turtle menu = "Press 1 for Flower" UserChoice = input(menu) #function to draw squares def draw_square(square): for i in range(0,2): square.forward(100) square.right(70) square.forward(100) square.right(110) #function to draw flower def draw_flower(petalNumber): window = turtle.Screen() window.bgcolor("yellow") pen = turtle.Turtle() pen.shape("triangle") pen.color("red")    for number in range(0,petalNumber): draw_square(pen) pen.right(360/petalNumber) for i in range(0,4): pen.circle(20) pen.right(90)    pen.right(90) pen.forward(300) pen.right(90) draw_square(pen) pen.left(180) draw_square(pen) pen.left(270) pen.forward(200) window.exitonclick() #function for original art...

  • Please use python language to solve this problem. 3. Use turtle graphics to draw a spiral...

    Please use python language to solve this problem. 3. Use turtle graphics to draw a spiral as below. It does not have to look exactly like the one below, but it should be a path that spirals around a point many times. Upload a file called spiral py. When we run it using the python command it should draw the picture without any further modification. Hint: use a for or while loop Figure 3: spiral

  • Must be done in python. This will be connected to other turtle assignments. Might need a...

    Must be done in python. This will be connected to other turtle assignments. Might need a sleep at end. Swimming in a Pond In this function, you will draw a small pond and have the turtle first take a nice walk around it and then jump in. The pond will need to be drawn in the upper left quandrant of your screen. This function needs to do the following: Contain two parameters to denote the color of the path (pen...

  • Please help: For this project, you will create a shape drawing program using Turtle graphics. Your...

    Please help: For this project, you will create a shape drawing program using Turtle graphics. Your program will begin by asking the user how many points they would like to enter (# of vertices for the shape). Next, you will use a loop to input each X and Y coordinate and store these coordinates in lists. After inputting all of the coordinates, create a second loop that will draw and fill the shape using the coordinates that were entered. All...

  • Write a program in Python that will: Here are following requirements to completing Menu shapes: 1....

    Write a program in Python that will: Here are following requirements to completing Menu shapes: 1. Create a "MENU" with 4 - 5 options have the user click the option and thereafter ask the user to enter the amount of stars from 1 - 50. From there your "for loop" will create the shape. Menu options need to be: 1. Filled Triangle 2. filled Square 3. This can be any shape such as a Square, circle, a different angle of...

  • Using python Here is the code import turtle def draw_triangle(vertex, length, k): ''' Draw a ...

    Using python Here is the code import turtle def draw_triangle(vertex, length, k): ''' Draw a triangle at depth k given the bottom vertex.    vertex: a tuple (x,y) that gives the coordinates of the bottom vertex. When k=0, vertex is the left bottom vertex for the outside triangle. length: the length of the original outside triangle (the biggest one). k: the depth of the input triangle. As k increases by 1, the triangles shrink to a smaller size. When k=0, the...

  • Python 3.5 Code Part A: 10 points A tick is a short line that is used...

    Python 3.5 Code Part A: 10 points A tick is a short line that is used to mark off units of distance along a line. Write a function named drawTick() that uses a turtle parameter to draw a single tick of specified length perpendicular to the initial orientation of the turtle. The function drawTick() takes two parameters: 1. a turtle, t, that is used to draw 2. an integer, tickLen, that is the length of the tick When drawTick() is...

  • Python 3 coding with AWS/Ide. Objective: The purpose of this lab is for you to become familiar with Python’s built-in te...

    Python 3 coding with AWS/Ide. Objective: The purpose of this lab is for you to become familiar with Python’s built-in text container -- class str-- and lists containing multiple strings. One of the advantages of the str class is that, to the programmer, strings in your code may be treated in a manner that is similar to how numbers are treated. Just like ints, floats, a string object (i.e., variable) may be initialized with a literal value or the contents...

  • STAGE 1 In Stage #2 here are the requirements: • Keep the following requirements from Stage...

    STAGE 1 In Stage #2 here are the requirements: • Keep the following requirements from Stage #1 o Write code that calls a function named printMenu() • The printMenu() function will: • print the menu below . ask the user to input a value between 1 an 12 · return an integer value to your main program. • Within the printMenu() function: o I STRONGLY SUGGEST THAT YOU DO THESE ONE AT A TIME - get the loop working before...

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