Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
#NOTE:  the last line "input()" is only necessary when using the online interpreter
#Problem 1
#To make a square that is 50 pixels on each side what do
#you need to set x and y equal to?
from turtle import *
a=?
b=?

forward(a)
left(b)
forward(a)
left(b)
forward(a)
left(b)
forward(a)


#Problem 2
# Assign values to c,d,e,and f to make a parallelogram that is 45 pixels 
# on one side and 100 pixels on the other as well as # and a circle that 
# is 35 pixels in radius
from turtle import *
c=?
d=?
e=?
f=?
g=?
h=?
forward(c)
left(f)
forward(g)
left(d)
forward(c)
left(e)
forward(g)

circle(h)



#Problem 3
#Fill in the variables with numbers that make your image
#look like the image provided in the assignment.
from turtle import *

x = ?  #this will be a number between 0-1
y= ?
z = ?
a = ?
b = ?
c = ?
#hint: EXCEPT FOR a and x, all of the values will be between 40 and 100
#Do Not Change Anythhing below this line.
penup()
goto(-200,0)
width(a)
pencolor(0,1,0)
pendown()
forward(400)
penup()
goto(0,0)
fillcolor(x,0,0)
begin_fill()
left(y)
forward(b)
right(y)
forward(b+c)
right(y)
forward(b)
end_fill()
penup()
goto(170,b)
fillcolor(0,0,0)
begin_fill()
left(200)
forward(c)
left(z)
forward(160)
left(z)
forward(c)
end_fill()
goto(75,0)
begin_fill()
setheading(y)
forward(c)
right(y)
forward(40)
right(y)
forward(c)
end_fill()
goto(-150,140)
fillcolor(1,1,0)
begin_fill()
circle(30)
end_fill()
hideturtle()

input()


What I have tried:

Ive tried everything but my teacher says not to add any variables or change anything. Once you've filled the variables in the code. Copy and paste the code in turtle to test the code.

You can search up python turtle on google its called Turtle Trinket
Posted
Updated 2-Sep-21 14:31pm
v2
Comments
Richard MacCutchan 3-Sep-21 3:51am    
If you draw the shapes on a piece of pare it should be obvious what values you need.

1 solution

OK, so this is very easy to do if you just read the code. All you're doing is plugging in numbers where the ? marks are.
 
Share this answer
 
Comments
Nasrullah Hussain 3-Sep-21 10:36am    
I did the first and second problems but I don't know what numbers I need to plug in on the third problem. Its really confusing for me.
Dave Kreskowiak 3-Sep-21 10:45am    
THe process is no different for problem #3. Look at the code and match up what the commands are doing with what you see in the image attached to the assignment.

Nobody is going to do this for you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900