

Discover more from Daily Dose of Data Science
High-quality insights on Data Science and Python, along with best practices — shared daily.
Get a free 550+ page data science PDF guide and 450+ practice questions notebook.
Over 49,000 subscribers
Continue reading
Lesser-known Feature of f-strings in Python
While debugging, one often explicitly prints the name of the variable with its value to enhance code inspection.
Although there's nothing wrong with this approach, it makes your print statements messy and lengthy.
f-strings in Python offer an elegant solution for this.
To print the name of the variable, you can add an equals sign (=) in the curly braces after the variable. This will print the name of the variable along with its value but it is concise and clean.
I like to explore, experiment and write about data science concepts and tools. You could connect with me on LinkedIn.