One of the most underrated #Python modules?
**`turtle`**
We know it's used for teaching & not in the "real-world"
But it's usually used only for basic drawings & simple animations for kids–a very limited scope
_We can teach more advanced topics, too…_
Here are some examples…
---
# 1. Data structures: lists, tuples, dictionaries, and sets
Here's an animation that uses all four of these structures:
_[Practise Using Lists, Tuples, Dictionaries, and Sets in Python With the Chaotic Balls Animation](https://thepythoncodingbook.com/2021/10/31/using-lists-tuples-dictionaries-and-sets-in-python/)_
---
# 2. Named Tuples
And a bit further down the line, here's an example of a `turtle` animation of a sunrise that introduces Named Tuples:
_[Sunrise: A Python Turtle Animation using Named Tuples](https://thepythoncodingbook.com/2022/06/12/python-turtle-animation-using-named-tuples-sunrise/)_
---
# 3. Demonstrating real-world processes
Maybe we want to use it model real-world processes in a quick-and-simple way.
Here is a demonstration of "simulating" bouncing balls
There's the single ball version:
_[The Real World in Python: Coding A Bouncing Ball](https://thepythoncodingbook.com/2021/08/19/simulating-a-bouncing-ball-in-python/)_
and the many balls one which deals with **object-oriented programming**:
_[Bouncing Balls Using Object-Oriented Programming in Python](https://thepythoncodingbook.com/2021/09/09/using-object-oriented-programming-in-python-bouncing-balls/)
And, one of my favourites, a simulations of planets orbiting one or more stars. The `turtle` version is in 2D:
_[Simulating Orbiting Planets in a Solar System Using Python](https://thepythoncodingbook.com/2021/09/29/simulating-orbiting-planets-in-a-solar-system-using-python-orbiting-planets-series-1/)_
_There's also a 3D version which uses Matplotlib instead of turtle, but that's off-topic here so I'll post another time_
---
Here are some more ideas from projects I've written up recently
https://thepythoncodingbook.com/category/turtle/
I have loads and loads more which I'll try to write up and publish in the coming months
#animations #python #turtle #coding #programming #LearnToCode #LearnPython
@jimlawless yes, but I think the classic examples of drawing triangles and squares and so on are _very_ limited in scope and can get boring and childish very quickly.
The module can be used for a lot more than that…
@s_gruppetta I think it should allow Python to tick all the boxes that Papert's Logo language did for permitting children to primarily build functions that draw objects ... such as the examples of drawing a triangle and a rectangle and then combining them to draw a little house.
I think most of the material in the Mindstorms book could be adapted to some rudimentary Python constructs.