Advertisement
shh_algo_PY

Example - City Project

May 6th, 2022
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.09 KB | None | 0 0
  1. from turtle import*
  2. speed(100)
  3.  
  4. def background():
  5.     penup()
  6.     goto(-250,0)
  7.     pendown()
  8.     color("blue")
  9.     width(500)
  10.     forward(500)
  11.     penup()
  12.     goto(-250,-230)
  13.     pendown()
  14.     color("green")
  15.     width(50)
  16.     forward(500)
  17.  
  18. def sun():
  19.     penup()
  20.     pensize(3)
  21.     goto(140, 140)
  22.     pendown()
  23.     begin_fill()
  24.     color('orange', 'yellow')
  25.     for i in range(18):
  26.        forward(40)
  27.        left(100)
  28.     end_fill()
  29.  
  30. def star():
  31.     penup()
  32.     goto(-200,150)
  33.     pendown()
  34.     begin_fill()
  35.     i = 0
  36.     color("yellow")
  37.     while i < 5:
  38.         forward(100)
  39.         left(144)
  40.         i = i + 1
  41.     end_fill()
  42.     penup()
  43.  
  44. def pentagon(colour):
  45.     color(colour)
  46.     penup()
  47.     pensize(2)
  48.     pendown()
  49.     begin_fill()
  50.     for i in range(5):
  51.         forward(100)
  52.         left(72)
  53.     end_fill()
  54.     penup()
  55.  
  56. background()        # YOU CAN TEST! BUT DELETE BEFORE GOING TO NUMBER 3
  57. sun()
  58. star()
  59. goto(-200,-200)
  60. pentagon('pink')
  61. goto(-50,-200)
  62. pentagon('lavender')
  63. hideturtle()
  64.  
  65. exitonclick()       # DELETE THIS BEFORE NUMBER 3
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement