assertion error python

Assertions is one of the most advanced Exception Handling technique used in python by using the Assert statement,we can create debug message,if anything logically end up with an error.If anything fails logically AssertionError will display and end the process. here we will check assertion error python
When we are working with automatic car project their is a situation of fuel tank is empty that time we have to stop all process and stop the vehicle with an error message “no fuels”

See the syntax here

assert Expression[, Arguments]

Create a file with below function

def fuelLevel(fuel):
   assert (fuel > 0),"Sorry no fuel in the system"


Run from command prompt

assertion error python

1 thought on “assertion error python”

  1. Good article! We will be linking to this particularly great content on our website.
    Keep up the great writing.

Leave a Reply

Your email address will not be published. Required fields are marked *