What are f-strings

f-strings, or formatted string literals, are a feature in Python that allows for easy and readable string formatting. Introduced in Python 3.6, f-strings make it possible to embed expressions inside string literals, using curly braces {}. This enhances code clarity and reduces the need for concatenation or the `str.format()` method.

Here is a simple example of how f-strings work:

name = "John"
            age = 30
            greeting = f"Hello, my name is {name} and I am {age} years old."
            print(greeting)
            # Output: Hello, my name is John and I am 30 years old.
            

f-strings Python string formatting programming code clarity