What is the purpose of f before a string in Python?

Exactly, Richaa! I’ve been exploring Python alternatives to f-strings, so here’s another way to achieve the same result if you’re curious: using the str.format() method. While f-strings are newer and more concise, the .format() method works for embedding dynamic content too. Here’s how you’d do it:

print('Column names are {}'.format('-'.join(row)))  

This produces the same result as an f-string:

Column names are 1-2-3  

It’s a bit more verbose, but it was the go-to method before Python 3.6. Plus, it still works perfectly if you’re using an older Python version. So, if someone ever asks what does f mean in Python, you can also tell them about these alternatives!