Rodrigo Girão Serrão 🐍🚀 @mathspp.com · Nov 11

Your future you will thank you for this: The keyword `assert` takes an expression to its right. If the expression evaluates to `True`, or Truthy, everything is fine. But if it doesn’t, you get an `AssertionError`. That's a pretty unhelpful/generic error... Here's the fix:

2 likes 1 replies

?

Replies

Rodrigo Girão Serrão 🐍🚀 · Nov 11

In front of the expression, add a comma and then a custom string. That custom string is the error message that will show up in front of the `AssertionError` if the assertion fails during runtime. Make sure it's a good error message with helpful context!