f-string function


What is f-string function in python? > In Python, an *f-string*, or *formatted string literal*, is a string that is prefixed with the letter f or F. These strings may contain replacement fields, which are expressions delimited by curly braces {}. When the string is evaluated, the expressions are replaced with their values.
 
The syntax looks like this:
name = "World"
message = f"Hello, {name}!"
print(message)  # Output: Hello, World!

Leave a Reply

Your email address will not be published. Required fields are marked *