Home » Python » Page 3

Python

How to Perform a Reverse Dictionary Lookup in Python: Generator Expressions and More

Welcome to yet another Python tutorial. Today, we’re taking a look at dictionaries and how we can perform a reverse dictionary lookup. In words, how do we get a key from a dictionary given a value? As it turns out, there are three main solutions. First, we could try explicitly looping over the dictionary using something like my_dict.items(). Alternatively, we could ...

Read More »

71 Python Code Snippets for Everyday Problems

If you’ve been following me for any amount of time, you know that I regularly publish Python code snippets for everyday problems. Well, I figured I’d finally aggregate all those responses in one massive article with links to all those resources. Everyday Problems In this section, we’ll take a look at various common scenarios that arise and how to solve ...

Read More »

The Controversy Behind The Walrus Operator in Python

If you haven’t heard, Python 3.8 features a rather controversial new operator called the walrus operator. In this article, I’ll share some of my first impressions as well as the views from all sides. Feel free to share some of your thoughts as well in the comments. Understanding the Walrus Operator Recently, I was browsing dev.to, and I found a ...

Read More »

How to install Anaconda or Miniconda in Colab

Colab is the Google’s platform for working with Python notebooks and practice Deep Learning using different frameworks. It is a powerful platform, there is availability of GPUs or TPUs, it allows to use your Google Drive space for notebooks and data, has a friendly user interface and lots of useful features, but in order to install/update Python packages, it comes ...

Read More »

How to Print on the Same Line in Python: Print and Write

As someone who teaches a lot of beginner programming content, I occasionally stumble upon questions like “how do you print on the same line in Python?” Luckily, I have an answer to that! In short, there are two main ways to print on the same line in Python. For Python 2, use the following print syntax: print "Williamson",. For Python ...

Read More »