Advertisement
timber101

Turtle_Basics_Part_3

Mar 3rd, 2022
711
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None
  1. #  Python basics
  2.  
  3. #  https://docs.python.org/3/library/turtle.html#
  4.  
  5. import turtle  # imports turtle library
  6.  
  7. wn = turtle.Screen()# creates wn as a screen
  8. wn.bgcolor("lime") # creates a lime screen
  9.  
  10. eve= turtle.Turtle() # creates a turtle called eve
  11. eve.shape("arrow")# changes shape of eve
  12. eve.color("blue")# changes colour of eve
  13. eve.penup() # takes eve off the screen
  14.  
  15. steps = 20 # variable to control number of steps eve moves
  16.  
  17. for i in range(30): # do this 30 times
  18.     eve.stamp() # stamp eve onto the page
  19.     eve.fd(steps) # move eve forward the number of steps in steps
  20.     steps = steps +2 # increase steps by 2
  21.     eve.rt(21) # right turn 21 degrees
  22.  
  23. wn.exitonclick() #closes the screen
Advertisement
RAW Paste Data Copied
Advertisement