Python Bytes

A powerful way to check multiple conditions in Python

Hey All,

I hope you are all doing well!

Welcome to Python Bytes!

We’ll explore an efficient, stylish, and readable way to check multiple conditions in Python in this byte!

Ready?! Let’s GO!


Here is the code you can dive into for folks who don’t have the patience to watch the video!

Checking multiple conditions using ‘or’ operator

The ‘or’ operator does the job for us, no doubt!

But, as the number of conditions increases, the ‘or’ operator will stretch your ‘if’ statement out, like a train. 🚂

I hope you agree with me on that!

Having said that, now you can ask, what’s the better way, right?!

Let’s explore that!

Here’s a cool way of checking multiple conditions using the ‘in’ operator.

Checking multiple conditions using the ‘in’ operator

That’s it, Folks!

Hope you enjoyed this episode of Python Bytes!

Python Byte Tip Credit — Görkem Arslan, Jonny Jackson & Pylint

This byte was created using Ultron V4’s auto-simulation technology, an AI crafted by Team DevOps at @ Kissflow

Follow me @iSwamiK for more bytes on DevOps Transformation!

Stay tuned!



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
Swami K

Swami K

As Senior Director of DevOps @ Kissflow Inc, I drive my team into exploring the best! DevOps & SRE practices! Stay tuned to listen to our stories!