Python Snippets
Assignment expressions in Python
Learn about Python's new assignment expression syntax and walrus operator. Assignment expressions can cut down on boilerplate code and improve efficiency!
Python Snippets
Learn about Python's new assignment expression syntax and walrus operator. Assignment expressions can cut down on boilerplate code and improve efficiency!
Python Snippets
Learn how to use the collection module's namedtuples to make your Python code even more clear and readable!
Python Snippets
Learn all about Python's divmod function, which allows us to easily perform floor division and modulo operations in one go!
Python Snippets
You may be familiar with Python's format method, but what about the format function? Learn to use Python's formatting language without string interpolation!
Python Snippets
In this post we cover a lesser known string method called partition. It has a lot of similarities to split, but there are some interesting differences.
Python Snippets
In this post we dive deeper into Python's formatting syntax, learning about displaying numbers in different bases. We also make a neat colour converter too!
Python Snippets
In this post we continue looking at formatting, this time exploring nested string interpolation, which we can use to dynamically set formatting options.
Python Snippets
Learn how to leverage Python's detailed formatting language to control how numbers are displayed in your applications.
Python Snippets
Learn about conditional statements in Python: a slightly obscure bit of syntax that allows for succinct conditional logic, particularly during assignments.
Python Snippets
In this post we learn about choices and sample: two useful functions in the random module used for generating collections of random values.
Python Snippets
In this snippet post we look at the update method for dictionaries. We can use update to change several values at once or extend dictionaries with new keys.
Python Snippets
In this week's Python snippet post we look at the extend method for lists. Extend works a lot like append, but allows us to append many values at once.