Catch all errors except KeyboardInterrupt

In this article, we will learn how to catch all the errors in Python except KeyboardInterrupt. We will also be learning this alongside examples to make us understand better. Without further ado, let’s begin! First things first, let’s refresh our memories on the hierarchy of exceptions, refer to the following chart: What we’re trying to … Read more

5 Examples of Mutable Datatypes in Python

In this article let us look at 5 examples of mutable datatypes in Python. If you wish to develop your physique like Mr. Arnold, “understanding” how to perform exercises like squats, bench presses, etc., is not enough, you need to “consistently work your muscles” to build up your mass and strength! Learning Python is no … Read more

5 Examples of Immutable Datatypes in Python

In this article let us look at 5 examples of immutable datatypes in Python. If you wish to develop your physique like Mr. Arnold, “understanding” how to perform exercises like squats, bench presses, etc., is not enough, you need to “consistently work your muscles” to build up your mass and strength! Learning Python is no … Read more

Hierarchy of Exceptions in Python

The Python programming language provides us with an extensive and myriad of exception classifications. The idea behind this classification is to make it easy for us to figure out the nature of the triggered exception so that we can debug it easily.  Let’s say, for instance, any operating system problem would be classified under the … Read more

Python Raising Error With a Custom Message

In this article, we’ll see how to raise an error with a custom message in Python. We’ll learn how to use the ‘raise’ statement and we’ll practice this all with the help of examples. What is the ‘raise’ statement? The ‘raise’ statement allows you to throw/raise any error manually.  For example: Running that results in … Read more

KeyboardInterrrupt: Everything You Need to Know!

In this article, let us learn what KeyboardInterrupt is, and how to effectively handle it in our Python programs. What is KeyboardInterrupt? The KeyboardInterrupt is an exception in Python that is raised when the user presses a pre-defined key-combination while the program is executing. In most operating systems, ctrl + c is used as the … Read more

“raise vs raise e” Explained!

In this article, we will be looking at the ‘raise’ vs ‘raise e’ statements. We will learn what they mean, their differences, and when they are used.  The ‘raise’ statement is used to manually raise an exception in Python. For example, you can manually raise a ValueError exception like this When to use raise by … Read more