Stephen Gruppetta
• Rethinking how to teach coding to children & adults • https://t.co/ThObHuu1rG • @codetoday_ & @ThePythonPlace • RealPython author • Ex-Physicist •
View on 𝕏Threads
––– Day 7 ––– ––– Generator ––– So, the term generator is used to refer to two different (but related) things: • A generator function is a function which has a `yield` statement...
We often use `zip()` with two iterables… …but we can also use it with more Let's explore zipping three iterables together [while I try to imagine how often a real-life 3-way zip...
When learning about the `random` module, often `randint()` is the first and main function covered But what if you want random floats and not random integers? Let's have a brief l...
You may think there's no difference between removing an item from the beginning or from the end of a list But there is, and it's not small! Here's my version of the code to compa...
One thing that many find very confusing when they first learn about generators is that once they're exhausted they're, erm, exhausted. Eh?! Let's see what this means with an exam...
Day 6 of the Python functions series: • more on *args & **kwargs In this thread, we'll look at functions with some combination of "normal" positional arguments, *args, and **kwar...
I know many schools are using The Python Coding Book and its tutorials for teaching Python Although this content was written with adult learners in mind, a lot of the work I do da...
Another feature of the `for` loop that many beginners are surprised to see is the `else` clause Let's assume you want to find the first palindrome in a list of names: names = ["J...
Yesterday, I compared scope in Python with "rooms"! This is part of a broader analogy I use a lot when teaching which I call The White Room analogy. I find this "picture" very us...
In the early days of learning to code in Python, you learn about data types and data structures… …but you also hear lots of other terms such as • sequence • container • iterable...
__str__() and __repr__() dunder methods "There are two kinds of string representations when you define a class "__str__() is the user-friendly one. "It’s meant for the user of a...
You know about the `for` loop, I know. But do you? Are you sure? Let's break the `for` loop down to see what's happening just a bit underneath the surface Read on… 👇🪡🧵 #Pytho...