Debugging with f-strings PREMIUM

Series: Strings
Trey Hunner smiling in a t-shirt against a yellow wall
Trey Hunner
4 min. read 3 min. video Python 3.8—3.12

If you're using print calls to debug your Python code, consider using f-strings with self-documenting expressions instead.

A broken Python program

Here we have a program that makes a random math prompt and then validates whether the answer give by the user is correct:

...

A Python Tip Every Week

Need to fill-in gaps in your Python skills? I send weekly emails designed to do just that.