Advertisement
lubattillah

star

Jun 7th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. Algorithms for drawing a star
  2. input sides of a star which must be greater than or equal to 5,n
  3. input length of sides of a start, any length,l
  4. fix the angle to 144 degrees
  5. pen down
  6. repeat n
  7. move l steps
  8. turn angle degrees
  9.  
  10. code:
  11. from turtle import Turtle
  12. t=Turtle()
  13. n = int(input("Enter sides of a polygon: "))
  14. l = int(input("Enter length of sides of a polygon: "))
  15. angle = 144
  16. for x in range(n):
  17. t.forward(l)
  18. t.right(angle)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement