Beispiele und Musterlösungen
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.

hello.py 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # Zeichnen des Wortes "Hello" mit der Turtle
  2. from turtle import Turtle
  3. def space(turtle):
  4. turtle.penup()
  5. turtle.forward(30)
  6. turtle.pendown()
  7. def draw_h(turtle):
  8. turtle.left(90)
  9. turtle.forward(100)
  10. turtle.backward(50)
  11. turtle.right(90)
  12. turtle.forward(50)
  13. turtle.left(90)
  14. turtle.forward(50)
  15. turtle.backward(100)
  16. turtle.right(90)
  17. def draw_e(turtle):
  18. turtle.left(90)
  19. turtle.forward(100)
  20. turtle.right(90)
  21. turtle.forward(50)
  22. turtle.backward(50)
  23. turtle.right(90)
  24. turtle.forward(50)
  25. turtle.left(90)
  26. turtle.forward(30)
  27. turtle.backward(30)
  28. turtle.right(90)
  29. turtle.forward(50)
  30. turtle.left(90)
  31. turtle.forward(50)
  32. def draw_l(turtle):
  33. turtle.left(90)
  34. turtle.forward(100)
  35. turtle.backward(100)
  36. turtle.right(90)
  37. turtle.forward(50)
  38. def draw_o(turtle):
  39. turtle.penup()
  40. turtle.forward(40)
  41. turtle.pendown()
  42. turtle.circle(50)
  43. turtle.penup()
  44. turtle.forward(40)
  45. turtle.pendown()
  46. sophia = Turtle()
  47. sophia.speed(0)
  48. draw_h(sophia)
  49. space(sophia)
  50. draw_e(sophia)
  51. space(sophia)
  52. draw_l(sophia)
  53. space(sophia)
  54. draw_l(sophia)
  55. space(sophia)
  56. draw_o(sophia)
  57. sophia.screen.mainloop()