|
123456789101112131415161718192021222324252627 |
- import math
- from turtle import Turtle
-
- def draw_santas_house(turtle, length):
- turtle.left(90)
- turtle.forward(length)
- turtle.right(90)
- turtle.forward(length)
- turtle.right(90 + 45)
- turtle.forward(math.sqrt(2*length*length))
- turtle.left(90 + 45)
- turtle.forward(length)
- turtle.left(90 + 45)
- turtle.forward(math.sqrt(2*length*length))
- turtle.right(45 + 30)
- turtle.forward(length)
- turtle.right(120)
- turtle.forward(length)
- turtle.right(30)
- turtle.forward(length)
-
-
-
- Turtle.draw_santas_house = draw_santas_house
- sophia = Turtle()
- sophia.draw_santas_house(200)
- sophia.screen.mainloop()
|