What will be the output of the following Python code? [code]import turtle t=turtle.Pen() for i in range(0,5): t.left(144)

Ngô Quốc Huy

New member
What will be the output of the following Python code?
Code:
import turtle
t=turtle.Pen()
for i in range(0,5):
        t.left(144)
        t.forward(100)
A. Trapezium
B. Parallelepiped
C. Tetrahedron
D. Star
 
Answer: d
Explanation: It is clear from the above code that 5 lines will be drawn on the canvas, at an angle of 144 degrees. The only shape which fits this description is star. Hence the output of the code shown above is star.
 

Tìm kiếm

Back
Top