Advent of Code 🧑💻 live-stream https://www.youtube.com/@mathsppblog/live
Get a daily drop of Python knowledge 🐍💧 -> https://mathspp.com/drops
And we'll also be going back to the visualisation for yesterday's problem...
The link is in my profile :)
And we'll also be going back to the visualisation for yesterday's problem...
The link is in my profile :)
“Recursion is useless”
That's a coping mechanism because you're afraid of recursion...
But you shouldn't be afraid!
Recursion is actually nice ✨
And it's a very natural way to express certain algorithms...
Let me show you an example.
“Recursion is useless”
That's a coping mechanism because you're afraid of recursion...
But you shouldn't be afraid!
Recursion is actually nice ✨
And it's a very natural way to express certain algorithms...
Let me show you an example.
So I arrived at the train station, saw a tourist couple trying to buy tickets, and offered to help.
They sorted the tickets out by themselves but wanted to double-check the platform they should be in.
I tell them the right one…
So I arrived at the train station, saw a tourist couple trying to buy tickets, and offered to help.
They sorted the tickets out by themselves but wanted to double-check the platform they should be in.
I tell them the right one…
That's $166 worth of books for a pretty penny.
Here's the link: 📚 mathspp.gumroad.com/l/all-books-...
Enjoy the books :)
That's $166 worth of books for a pretty penny.
Here's the link: 📚 mathspp.gumroad.com/l/all-books-...
Enjoy the books :)
See you there?
Advent of Code 🧑💻 live-stream: www.youtube.com/@mathsppblog...
See you there?
Advent of Code 🧑💻 live-stream: www.youtube.com/@mathsppblog...
See you there?
Advent of Code 🧑💻 live-stream: www.youtube.com/@mathsppblog...
The next step?
Using fast exponentiation with repeated squaring to compute terms at LIGHTNING FAST speeds ⚡️🤓
The next step?
Using fast exponentiation with repeated squaring to compute terms at LIGHTNING FAST speeds ⚡️🤓
Does anyone have any tips? :D
Both general streaming tips and specific YT-related ones?
Does anyone have any tips? :D
Both general streaming tips and specific YT-related ones?
...plus a bonus non-Python sale from @b0rk.jvns.ca because the zines are too good not to mention.
...plus a bonus non-Python sale from @b0rk.jvns.ca because the zines are too good not to mention.
I just have fun doing it. 🤷
And I was thinking about `itertools.pairwise` and its generalisation, `nwise`...
And how you could implement `nwise` in different ways.
Here's what I got:
I just have fun doing it. 🤷
And I was thinking about `itertools.pairwise` and its generalisation, `nwise`...
And how you could implement `nwise` in different ways.
Here's what I got:
That's a bit criminal 🤣
After the BF I'll have to increase the price of this book!
mathspp.gumroad.com/l/python-dr...
That's a bit criminal 🤣
After the BF I'll have to increase the price of this book!
mathspp.gumroad.com/l/python-dr...
(Also in preparation for Advent of Code.)
Give it a read and let me know what you think -> mathspp.com/blog/floodfi...
I tried using PyScript for the interactive demos...
(Also in preparation for Advent of Code.)
Give it a read and let me know what you think -> mathspp.com/blog/floodfi...
I tried using PyScript for the interactive demos...
It includes some interactive demos I created with PyScript!
I was still developing and testing the demos...
But someone shared it online in a major Python newsletter...
So, I guess the cat's out of the bag !
It includes some interactive demos I created with PyScript!
I was still developing and testing the demos...
But someone shared it online in a major Python newsletter...
So, I guess the cat's out of the bag !
The string method `split` has a counterpart `rsplit` that starts splitting from the end of the string.
This is useful if you only want the final segment(s) of a string.
The string method `split` has a counterpart `rsplit` that starts splitting from the end of the string.
This is useful if you only want the final segment(s) of a string.
If you do, I've got the perfect Python string method for you:
`str.title`
Changes the case of any string into title case.
“star wars: the empire strikes back”
becomes
“Star Wars: The Empire Strikes Back”.
Much more professional!
If you do, I've got the perfect Python string method for you:
`str.title`
Changes the case of any string into title case.
“star wars: the empire strikes back”
becomes
“Star Wars: The Empire Strikes Back”.
Much more professional!
Maybe you need to test a function that requires a file-like object.
Or maybe you need a buffer because you're processing an amount of data so large that it doesn't fit into memory...
In these situations, `tempfile.TemporaryFile` can help you out.
Maybe you need to test a function that requires a file-like object.
Or maybe you need a buffer because you're processing an amount of data so large that it doesn't fit into memory...
In these situations, `tempfile.TemporaryFile` can help you out.
You CAN use this data structure for this.
Note how, from a pedagogical standpoint, this is an instructive example.
What the commenters see:
You HAVE to use this code EXACTLY like this and this is the ABSOLUTE BEST solution in EVERY context.
You CAN use this data structure for this.
Note how, from a pedagogical standpoint, this is an instructive example.
What the commenters see:
You HAVE to use this code EXACTLY like this and this is the ABSOLUTE BEST solution in EVERY context.
When I do, I create it by inheriting from `list`.
This gives me almost everything I want for free!
When I do, I create it by inheriting from `list`.
This gives me almost everything I want for free!
A moving average function.
Manually keeping track of all the values being considered for the window is a pain!
Unless you use `collections.deque`.
Its param `maxlen` makes the window automatically evict the values you don't need.
It was supposed to be a reference article...
And I forgot to talk about docstrings! 🤦
What's worse is that no one event pointed that out to me!
I've fixed it now: mathspp.com/blog/pydont...
It was supposed to be a reference article...
And I forgot to talk about docstrings! 🤦
What's worse is that no one event pointed that out to me!
I've fixed it now: mathspp.com/blog/pydont...
A moving average function.
Manually keeping track of all the values being considered for the window is a pain!
Unless you use `collections.deque`.
Its param `maxlen` makes the window automatically evict the values you don't need.
A moving average function.
Manually keeping track of all the values being considered for the window is a pain!
Unless you use `collections.deque`.
Its param `maxlen` makes the window automatically evict the values you don't need.
I mean, after 200 ⭐️⭐️⭐️⭐️⭐️ reviews, this anonymous user could think for a second and realise that the issue wasn't mine/the book's...
🤡
I mean, after 200 ⭐️⭐️⭐️⭐️⭐️ reviews, this anonymous user could think for a second and realise that the issue wasn't mine/the book's...
🤡
I have a folder in a repo with cloudflare workers:
workers/
workerA/**
workerB/**
I want to deploy workers that get changed but not the others!
That's when dorny/path-filters comes in handy! ✨
I have a folder in a repo with cloudflare workers:
workers/
workerA/**
workerB/**
I want to deploy workers that get changed but not the others!
That's when dorny/path-filters comes in handy! ✨