Debugging with f-strings PREMIUM

Trey Hunner smiling in a t-shirt against a yellow wall
Trey Hunner
4 min. read 3 min. video Python 3.7—3.11
Tags
Python Morsels
Watch as video
02:45

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.

Python Morsels
Watch as video
02:45