Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this code, I have it started here import sys import turtle menu = Press 1 for Flower UserChoice = input(menu) #function

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 def originalArt(): print("This function will draw the original art")

#function for colorful art def colorfulArt(): print("This function will draw the colorful art")

#if statement check the user choice if(UserChoice == "1"): numberOfPetals= int(input("How many petals?")) #the next line calls the draw_flower function draw_flower(numberOfPetals) elif(UserChoice == "2"): originalArt() #this line calls the originalArt function elif(UserChoice == "3"): colorfulArt()

image text in transcribed

The program will ask the user which picture they would like to see: a Flower, an Original Picture, a Color Filled Picture Using the drawSquare function, you can have the turtle draw a square shape 2. 3. a. Write a function drawFlower that takes the number of squares to draw as a parameter (numSquares) and draws a flower by repeating a call to the drawSquare function numSquares times. You will need to figure out how far to turn the turtle based on numSquares 4. Write a function drawMyPic to have the turtle draw a simple line drawing of anything you want. 5. There are two built-in functions that the turtle understands: begin f ill O and end fill. When begin_fill is called, the turtle keeps track of its starting point, and all the lines it has drawn until end f ill is called. When endfill is called, the turtle fills in the space enclosed by the lines that the turtle has drawn. Use these new functions to dravw a more interesting picture Write a function drawColorPic to have the turtle draw a line drawing of anything you want that includes at least three color filled areas a

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions

Question

KEY QUESTION Refer to columns 1 and 6 in the table for question

Answered: 1 week ago