AI engineering glossary · Python core

What is f-string?

f-string (also called formatted string literal): A string literal prefixed with f that embeds expressions inside curly braces, which Python evaluates and inserts into the text. It supports format specifiers after a colon for width, decimals and alignment, making it the preferred way to build messages.

Level: beginnerTopic: Python core

f-string: an example

name = 'Meera'; f'Hello {name}, total = {1234.5:.2f}' produces 'Hello Meera, total = 1234.50'.

Related terms

More Python core terms

Where you learn it

f-string is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.