Question: Both of these programs draw a square however the code for each program is different. After reading Chapter 4 and looking at the code in
Both of these programs draw a square however the code for each program is different. After reading Chapter 4 and looking at the code in each of these Python files please submit your response to the following two questions:
1. Explain how the code is different in each program yet both draw a square that is the exact same size. How is this possible?
2. Why is the position of the Turtle cursor pointing in a different direction in the square that is drawn in each program? Explain your answer.
PROGRAM 1:
import turtle bob = turtle.Turtle() print(bob)
bob.fd(100) bob.lt(90)
bob.fd(100) bob.lt(90)
bob.fd(100) bob.lt(90)
bob.fd(100)
turtle.mainloop()
PROGRAM 2:
import turtle bob = turtle.Turtle() print(bob)
for i in range(4): bob.fd(100) bob.lt(90)
turtle.mainloop()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
