How to Iterate Over Multiple Lists at the Same Time in Python: Zip() and More!
One common scenario when working with lists is the desire to loop over them in parallel. In this article, we cover a few ways to do just that.
How to Iterate Over Multiple Lists at the Same Time in Python: Zip() and More!
One common scenario when working with lists is the desire to loop over them in parallel. In this article, we cover a few ways to do just that.
How to Check If a Key Exists in a Dictionary in Python: in, get(), and More
One of my favorite Python data structures is the dictionary. Of course, I don't love getting an error when my key doesn't exist. Luckily, there's a way to check.
How to Loop Over a Dictionary in Python: Keys, Values, and More
Looping over data structures in Python is always an interesting challenge. That's why we're going to look at dictionaries today.
How to Split a String by Whitespace in Python: Brute Force and split()
There are a lot of ways to manipulate strings. For instance, we might be interested in splitting a string by a separator like whitespace.
How to Convert a String to Lowercase in Python: lower() and More
As this series grows, I've started poking at seemingly simple problems to expose their complexity. This time, I thought it would be interesting to look at how to convert a string to lowercase. As...
How to Round a Number in Python: Truncation, Arithmetic, and More
Remember learning to round in grade school? Me too! The only problem is I don't use the idea very often. As a result, I don't always remember how to round a number in programming contexts like...