An f-string is a Python string literal prefixed with f that evaluates expressions inside curly braces. It combines text and computed values without separately passing formatting parameters. section 1.6
Use f-strings when output needs both readable text and values such as numbers, names, or expression results. Expressions can include arithmetic and method calls, while format specifications control presentation. section 1.6 section 1.13
Formatting an imprecise float
>>> s = 0.1 + 0.7 >>> print(s) 0.7999999999999999 >>> print(f'{s:.2f}') 0.80 The f-string controls displayed precision; it does not make floating-point arithmetic exact. Use integers instead of floats when sensitive measurements require that choice. section 1.13



