asked 18.3k views
4 votes
Q1 – A python script is attached below. Please choose the correct approach to update it so that it will draw a square instead of a line.

import turtle
t1 = turtle.Turtle()
for m in range(4):
t1.forward(50)
turtle.done()
A. Add “t1.right(90)” in the for loop, after the forward(50) statement.
B. Add “t1.right(90)” before the for loop.
C. Replace “t1.forward(50)” with “t1.square()” statement.
D. Replace “t1.forward(50)” with “t1.left(90)” statement.

Q2 – Try the following script, what will you get?
G1 = turtle.Turtle()
for i in range(50):
G1.forward(50)
G1.right(144)
turtle.done()

A. A star
B. A circle
C. A square
D. A curve

1 Answer

5 votes

Answer:

A and A

Step-by-step explanation:

Q1 – The correct approach to update the script so that it will draw a square instead of a line is:

A. Add “t1.right(90)” in the for loop, after the forward(50) statement.

This will make the turtle turn right by 90 degrees after each forward movement, creating a square.

Q2 – The script will draw:

A. A star

The script moves the turtle forward by 50 units, then turns it right by 144 degrees. This process is repeated 50 times, creating a star pattern. The angle of 144 degrees is chosen because it is a divisor of 360, which ensures that the turtle returns to its starting position after completing the loop.

どういたしまして

answered
User Crissy
by
8.2k points