If you’re new to Python coding, you may have come across pass, break and continue. These words are known as control statements because they are used to perform specific tasks for control flow. In other words, they help tell Python when or for how long to do something, like running a loop, before moving on to something else.

When I first starting coding in Python, I often got confused about these particular keywords (special words that are reserved in Python). Understanding the differences between pass, break and continue can be difficult at first, but it is useful to learn when…


“Music is the universal language of mankind.”Henry Wadsworth Longfellow

Human beings have a natural ability to relate to the music they listen to and to communicate with others through the music they create, regardless of the language they speak. As music has progressed over the ages, we have developed new ways of talking about it through spoken and written language. Musical notation, for example, was adopted as a means of recording a piece of music in written form so that anyone who is familiar with this notation could pick it up and play.

In the modern area, music has…


Coding in Python can be made a lot easier with list comprehension, and this is why it is widely used in the Python community. Less popular but still fairly common is the dictionary comprehension, which works in a similar way, but there is another tool in the realm of Python comprehensions that is almost never talked about, and that is set comprehension. As you might have guessed, this is similar to other types of Python comprehensions but for modifying and generating sets. Here are the basics of what you need to know about them.

How it Works

The key aspect of set comprehension…


If you are out there exploring the world of Python, you will most likely have heard a lot of hype about list comprehension, but did you know there is also such a thing as dictionary comprehension? For anyone who is reading this and is not familiar with list comprehension, see my previous blog for help with that. This blog will be expanding on that knowledge to discuss the basics of dictionary comprehension, how it compares to list comprehension, and what we can do with it.

What is Dictionary Comprehension?

Like list comprehension, dictionary comprehension takes in a group of values, performs some kind of…


So you’re learning to code in Python, and you’re starting to understand how to work with different data types, variables, conditional statements, for loops, while loops, and maybe you’re feeling pretty good about it.

And then you see something like this:

[x+1 if x >= 5 else x+2 for x in l]

Josh Robin

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store