You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

santas_house.py 640B

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
123456789101112131415161718192021222324252627
  1. import math
  2. from turtle import Turtle
  3. def draw_santas_house(turtle, length):
  4. turtle.left(90)
  5. turtle.forward(length)
  6. turtle.right(90)
  7. turtle.forward(length)
  8. turtle.right(90 + 45)
  9. turtle.forward(math.sqrt(2*length*length))
  10. turtle.left(90 + 45)
  11. turtle.forward(length)
  12. turtle.left(90 + 45)
  13. turtle.forward(math.sqrt(2*length*length))
  14. turtle.right(45 + 30)
  15. turtle.forward(length)
  16. turtle.right(120)
  17. turtle.forward(length)
  18. turtle.right(30)
  19. turtle.forward(length)
  20. Turtle.draw_santas_house = draw_santas_house
  21. sophia = Turtle()
  22. sophia.draw_santas_house(200)
  23. sophia.screen.mainloop()