Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In the context of a function call in Python, the "f" before a string literal indicates that it is a formatted string literal. Formatted string literals, also known as f-strings, are a way to embed expressions inside string literals, using curly braces {}.

In the example you provided, the f in the function call title=f"Hello world" means that the string "Hello world" is a formatted string literal, and any expressions inside the curly braces {} will be evaluated and replaced with their values. For example, if you had a variable name containing the value "John", you could use an f-string like this:

name = "John"
title = f"Hello, {name}!"