Advertisement
Allena_Gorskaya

Урок 16. Программа 3

Feb 19th, 2019
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. #здесь будет код третьей программы
  2. from turtle import *
  3. from random import *
  4. speed('fastest')
  5. def vshape(size):
  6.     right(25)
  7.     forward(size)
  8.     backward(size)
  9.     left(50)
  10.     forward(size)
  11.     backward(size)
  12.     right(25)
  13.    
  14. def snowflakeArm(size):
  15.     for i in range(4):
  16.         forward(size)
  17.         vshape(size)
  18.     backward(4 * size)
  19.  
  20. colormode(255)
  21.  
  22. def snowflake(size, x, y):
  23.     penup()
  24.     goto(x, y)
  25.     pendown()
  26.     angle = randint(0, 60)
  27.     setheading(angle)
  28.     r = randint(0,255)
  29.     g = randint(0,255)
  30.     b = randint(0,255)
  31.     color(r, g, b)
  32.     for i in range(6):
  33.         snowflakeArm(size)
  34.         right(60)
  35.  
  36. for i in range(2):
  37.     a = randint(15,25)
  38.     x = randint(-int(window_width()/2), int(window_width()/2))
  39.     y = randint(-int(window_height()/2), int(window_height()/2))
  40.     snowflake(a, x, y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement