Turtle Flower Python Here is the starter code: import turtle menu = "Press 1 for Flower \n Press 2 for original art \n Press 3 for colourful art" User Choice = input(menu)
#function to draw squaresdef draw _square(square):for i in range(0,2):square .forward(100)square .right(70)square .forward(100)square .right(110)
#function to draw flowerdef draw _flower(petal Number):window = turtle .Screen()window. Bg colour("yellow")
pen = turtle. Turtle()pen. shape("triangle")pen .colour("red")for number in range(0,petalNumber):draw _square(pen)pen .right(360/petal Number)
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 .exit on click()
#function for original artdef original Art():print("This function will draw the original art")#function for colourful artdef colourful Art():print("This function will draw the colourful art")#if statement check the user choiceif(User Choice == "1"):number Of Petals= int(input("How many petals?"))#the next line calls the draw_ flower functiondraw_ flower (number Of Petals)life(User Choice == "2"):original Art() #this line calls the original Art functionlife(User Choice == "3"):colourful Art()
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here