# f-strings & Formatting — Python

Source: https://www.geekswithgeeks.com/en/python/py-fstrings-formatting

> Embed expressions in strings and control number formatting.

## Expressions inside {}

f-strings evaluate any expression inside `{}` — including function calls and math.

```python
name = "Ada"
score = 92.456
print(f"{name} scored {score:.1f}%")
print(f"Doubled: {score * 2:.0f}")
```

Output:

```
Ada scored 92.5%
Doubled: 185
```

## Format specifiers

Format specs after `:` control width, decimals, padding and commas — e.g. `f"{n:,}"` adds thousand separators.
