Объяснение:
import turtle
# настройки окна рисования
turtle.Screen().bgcolor("gray") # задаем цвет фона
turtle.speed(0) # устанавливаем максимальную скорость
# функция для рисования ветвей снежинки
def branch():
for i in range(3):
turtle.forward(30)
turtle.backward(30)
turtle.right(45)
turtle.left(90)
turtle.left(45)
turtle.right(135)
# рисуем снежинку
for i in range(8):
branch()
turtle.hideturtle() # скрываем черепашку
turtle.mainloop()
Объяснение:
import turtle
# настройки окна рисования
turtle.Screen().bgcolor("gray") # задаем цвет фона
turtle.speed(0) # устанавливаем максимальную скорость
# функция для рисования ветвей снежинки
def branch():
for i in range(3):
turtle.forward(30)
turtle.backward(30)
turtle.right(45)
turtle.left(90)
turtle.backward(30)
turtle.left(45)
for i in range(3):
turtle.forward(30)
turtle.backward(30)
turtle.right(45)
turtle.right(135)
turtle.forward(30)
turtle.right(45)
for i in range(3):
turtle.forward(30)
turtle.backward(30)
turtle.left(45)
turtle.left(90)
turtle.backward(30)
turtle.left(45)
for i in range(3):
turtle.forward(30)
turtle.backward(30)
turtle.right(45)
turtle.right(135)
turtle.forward(30)
turtle.right(45)
for i in range(3):
turtle.forward(30)
turtle.backward(30)
turtle.left(45)
turtle.left(90)
turtle.backward(30)
turtle.left(45)
for i in range(3):
turtle.forward(30)
turtle.backward(30)
turtle.right(45)
turtle.right(135)
turtle.forward(30)
turtle.right(45)
for i in range(3):
turtle.forward(30)
turtle.backward(30)
turtle.left(45)
turtle.left(90)
turtle.backward(30)
turtle.left(45)
for i in range(3):
turtle.forward(30)
turtle.backward(30)
turtle.right(45)
turtle.right(135)
turtle.forward(30)
turtle.right(45)
for i in range(3):
turtle.forward(30)
turtle.backward(30)
turtle.left(45)
turtle.left(90)
turtle.backward(30)
turtle.left(45)
for i in range(3):
turtle.forward(30)
turtle.backward(30)
turtle.right(45)
turtle.right(135)
turtle.forward(30)
turtle.right(45)
for i in range(3):
turtle.forward(30)
turtle.backward(30)
turtle.left(45)
turtle.left(90)
turtle.backward(30)
turtle.left(45)
for i in range(3):
turtle.forward(30)
turtle.backward(30)
turtle.right(45)
# рисуем снежинку
for i in range(8):
branch()
turtle.right(45)
turtle.hideturtle() # скрываем черепашку
turtle.mainloop()