Advertisement
Guest User

Sine curve

a guest
Mar 13th, 2015
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. import turtle, math
  2.  
  3. turtle.speed(0)
  4.  
  5. min = input("From: ")
  6. max = input("Until: ")
  7.  
  8. #draws the X-axis
  9. turtle.fd(max)
  10.  
  11. #draws the Y-axis
  12. turtle.goto(0, 0)
  13. turtle.penup()
  14. turtle.lt(90)
  15. turtle.fd(50)
  16. turtle.pendown()
  17. turtle.bk(100)
  18. turtle.penup()
  19. turtle.fd(50)
  20. turtle.pendown()
  21. turtle.rt(90)
  22.  
  23. #draws the curve
  24. turtle.goto(min, 0)
  25. for x in range(min, max):
  26.     y = 50*(math.sin(math.radians(x)))
  27.     turtle.goto(x, y)
  28.     x += 1.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement