Question
I am stuck on a python program... I am supposed to draw this parallelogram shape using turtle... i am not able to orient the turtle
I am stuck on a python program... I am supposed to draw this parallelogram shape using turtle... i am not able to orient the turtle to draw the next... I attached my code below
import turtle import math
#Ask user for numerical value of lenght S = eval(input("Enter a numerical value"))
#calculate lenght of parallelogram length = S /math.cos(math.pi/4)/2
#starting point for parallelogram turtle.penup() turtle.goto(-150,length /2) turtle.pendown()
#start drawing parallelogram (side 1) turtle.begin_fill() turtle.color("pink") turtle.forward(length) turtle.right(135) turtle.forward(length) turtle.right(45) turtle.forward(length) turtle.right(135) turtle.forward(length) turtle.left(45) turtle.penup() turtle.end_fill() turtle.pendown()
#Draw side 2 turtle.begin_fill() turtle.color("red") turtle.forward(length) turtle.left(135) turtle.forward(length) turtle.left(45) turtle.forward(length) turtle.left(135) turtle.forward(length) turtle.right(45) turtle.end_fill()
#Draw side 3 turtle.begin_fill() turtle.color("orange") turtle.forward(length) turtle.left(135) turtle.forward(length) turtle.left(45) turtle.forward(length) turtle.left(135) turtle.forward(length) turtle.right(45) turtle.end_fill()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started