Your investor just asked for last month's MRR. In your current workflow, where do you look first?
I open Stripe, filter to last month, screenshot the total, paste it into the email. Takes maybe ten minutes.
In Python, that number is a variable. mrr = 14850.0 is just naming it — a line item on your P&L with a name you chose. One = assigns; it doesn't compare. And combining that variable with a label uses an f-string — prefix the string with f, drop the variable inside curly braces, add :.2f to pin exactly two decimal places:
label = "MRR"
value = 14850.0
result = f"{label} — ${value:.2f}" # MRR — $14850.00So mrr = 14850.0 just stores the number — it doesn't evaluate to true or false? I keep reading it as "mrr equals 14850".
Correct — one = writes, two == reads. The assignment is silent. Once named, you wrap it in a function so you can call it for any metric:
def format_metric(label: str, value: float) -> str:
result = f"{label} — ${value:.2f}"
print(f"Formatted: {result}")
return resultSo this runs for MRR, CAC, ARPU — any metric — without me retyping the formula each time.
Named cells without the spreadsheet grief. Write it once, run it a hundred times. Forget the f prefix and every {label} prints literally. That's a silent bug — no error, wrong output, only surfaces when someone reads the email.
I've spent years wrestling with TEXT() formulas in Excel. This is embarrassingly straightforward by comparison.
That's the right reaction. The :.2f spec is the only formatting rule you need this week — it pins floats to two decimal places every time.
A variable is a label attached to a value. value = 14850.0 creates a float; label = "MRR" creates a str. Python infers the type — no declaration needed.
Prefix any string with f and embed variables inside {}. A spec after : controls numeric shape:
| Spec | Example | Output |
|---|---|---|
:.2f | f"{14850.0:.2f}" | 14850.00 |
:,.2f | f"{14850.0:,.2f}" | 14,850.00 |
:>5 | f"{7:>5}" | 7 |
f prefix — "{label}" prints literal braces. Silent bug.:.2f — 14850.0 renders as 14850.0. Inconsistent output.= vs == — assignment vs. comparison.Your investor just asked for last month's MRR. In your current workflow, where do you look first?
I open Stripe, filter to last month, screenshot the total, paste it into the email. Takes maybe ten minutes.
In Python, that number is a variable. mrr = 14850.0 is just naming it — a line item on your P&L with a name you chose. One = assigns; it doesn't compare. And combining that variable with a label uses an f-string — prefix the string with f, drop the variable inside curly braces, add :.2f to pin exactly two decimal places:
label = "MRR"
value = 14850.0
result = f"{label} — ${value:.2f}" # MRR — $14850.00So mrr = 14850.0 just stores the number — it doesn't evaluate to true or false? I keep reading it as "mrr equals 14850".
Correct — one = writes, two == reads. The assignment is silent. Once named, you wrap it in a function so you can call it for any metric:
def format_metric(label: str, value: float) -> str:
result = f"{label} — ${value:.2f}"
print(f"Formatted: {result}")
return resultSo this runs for MRR, CAC, ARPU — any metric — without me retyping the formula each time.
Named cells without the spreadsheet grief. Write it once, run it a hundred times. Forget the f prefix and every {label} prints literally. That's a silent bug — no error, wrong output, only surfaces when someone reads the email.
I've spent years wrestling with TEXT() formulas in Excel. This is embarrassingly straightforward by comparison.
That's the right reaction. The :.2f spec is the only formatting rule you need this week — it pins floats to two decimal places every time.
A variable is a label attached to a value. value = 14850.0 creates a float; label = "MRR" creates a str. Python infers the type — no declaration needed.
Prefix any string with f and embed variables inside {}. A spec after : controls numeric shape:
| Spec | Example | Output |
|---|---|---|
:.2f | f"{14850.0:.2f}" | 14850.00 |
:,.2f | f"{14850.0:,.2f}" | 14,850.00 |
:>5 | f"{7:>5}" | 7 |
f prefix — "{label}" prints literal braces. Silent bug.:.2f — 14850.0 renders as 14850.0. Inconsistent output.= vs == — assignment vs. comparison.You track MRR, CAC, and ARPU in Stripe and need clean metric labels for your Monday investor email. Write `format_metric(label, value)` that returns a string like `"MRR — $14850.00"` using an f-string with `:.2f` formatting — for example, `format_metric("MRR", 14850.0)` should return `"MRR — $14850.00"`.
Tap each step for scaffolded hints.
No blank-editor panic.