Back
+10 XP
Concept

f-string Tricks & f"{x=}"

Inside f-string curly brackets `{}`, you can run math and expressions:

python
print(f"Total: {10 * 5}")  # Total: 50

# 42. f-string Tricks & f"{x=}" Inside f-string curly brackets `{}`, you can run math and expressions: ```python print(f"Total: {10 * 5}") # Total: 50 ``` Best debugging trick in Python: append an `=` sign after your variable: ```python speed = 88 print(f"{speed=}") # Prints: speed=88 ``` Say goodbye to typing `print("speed =", speed)` like a caveman.

Checkpoint

If `latency = 42`, what does `print(f"{latency=}")` output?

Practice

Create `ping = 15`. Print it using the `f"{ping=}"` debugging trick.

Terminal
01
Tap code blocks below to assemble
Available Blocks