Starting With Python's assert Statement



Starting With Python's assert Statement

Starting With Python's assert Statement

Python’s assert statement allows you to write sanity checks in your code. These checks are known as assertions, and you can use them to test if certain assumptions remain true while you’re developing your code. If any of your assertions turn false, then you have a bug in your code.

This is a portion of the complete course, which you can find here:
https://realpython.com/courses/python-assert-statement/

The rest of the course covers how to:
– How assert can help you document, debug, and test your code
– How assertions can be disabled to improve performance in production
– What common pitfalls you might face when using assert statements
– Working with the PYTHONOPTIMIZE environment variable