Python · Syntax and control flow

f-string

Formats values into a string. Add :.2f for decimals or :>6 for alignment.

Syntax
f"Hello, {name}"

Example

Open in the lab

More in this group

break and continue del statement enumerate() for if / elif / else match statement pass range()

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course