scipiguy

Programming 102: Algorithm 2D shape

Jun 25th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. from turtle import fd, lt, rt, ht, st, fillcolor, begin_fill, end_fill
  2.  
  3. def draw_star(length, colour):
  4.     if colour == "Y":
  5.         fillcolor('yellow')
  6.     elif colour == "R":
  7.         fillcolor('red')
  8.     else:
  9.         fillcolor('blue')
  10.  
  11.     begin_fill()
  12.     for x in range(5):
  13.         fd(length)
  14.         lt(72)
  15.         fd(length)
  16.         rt (144)
  17.     end_fill()
  18.  
  19. length = int(input("How long should each side of the star be?" ))
  20. colour = input("What colour is your star? Enter Y for yellow, R for red or B for blue: ")
  21.  
  22. st()
  23. draw_star(length, colour)
  24.  
  25. ht()
Advertisement
Add Comment
Please, Sign In to add comment