elena_gancedo

One Star

Aug 7th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. from turtle import Turtle
  2. # Draw 8 equal figures together, which in each iteration
  3. # turn to the left about 10 degrees.
  4. turtle = Turtle()
  5. # Start painting the fill
  6. turtle.begin_fill()
  7. # Initialize the degrees to 0
  8. degrees = 0
  9. # Stroke speed
  10. turtle.speed(15)
  11. # To avoid repeating the orders I use the for loop
  12. for x in range(1, 8):
  13.     for x in range(0, 4):
  14.         turtle.color("blue")
  15.         # tells the virtual pencil to move 150 pixels forward
  16.         turtle.forward(150)
  17.         turtle.color("green")
  18.         # tells the virtual pencil to turn 90 degrees to the left
  19.         turtle.left(190)
  20.     # turn to the left about 10 degrees    
  21.     turtle.left(degrees + 10)
  22. # Finish painting the fill    
  23. turtle.end_fill()
  24.  
  25. elena = Turtle()
  26. elena.penup()
  27. elena.goto(-150,-90)
  28. elena.left(90)
  29. elena.goto(-75,-175)
  30. elena.color("purple")
  31. elena.write("My Star", None, None, "16pt bold")
  32. elena.goto(-75,-175)
Add Comment
Please, Sign In to add comment