8. A sprite is a simple spider shaped thing with n legs coming out from a center point. The angle
between each leg is 360 / n degrees.
Write a program to draw a sprite where the number of legs is provided by the user.
For example, when the user enters 6, they should get the following output

8 A sprite is a simple spider shaped thing with n legs coming out from a center point The angle between each leg is 360 n degrees Write a program to draw a spri class=

Respuesta :

import turtle

s = turtle.Screen()

t = turtle.Turtle()

t.penup()

t.goto(0,-10)

t.pendown()

t.fillcolor("black")

t.begin_fill()

t.circle(10)

t.end_fill()

legs = int(input("How many legs do you want your sprite to have? "))

i = 0

angle = 360 / legs

while i < legs:

   t.penup()

   t.goto(0,0)

   t.pendown()

   t.forward(30)

   t.back(30)

   t.right(angle)

   i += 1

s.mainloop()

You might need to adjust this to your liking. I was able to do everything but draw the triangles at the end of each leg. I hope this helps though.

ACCESS MORE