We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
Pattern Matching, f-Strings and Newer Syntax
PythonFormat text with f-strings and your own format codes, branch on the shape of data with match and case, and use := and keyword-only parameters where they make code clearer. The track ends with the syntax new in Python 3.14 and 3.15.
This track uses Python. You can make it your practice mode to browse related content across the site.
Your learning sequence
- 1 Not solved yet. Show Values with repr and str in f-Strings Practice · Easy
- 2 Not solved yet. Line Up Receipt Columns with f-Strings Practice · Easy
- 3 Not solved yet. Give a Class Its Own Format Codes Practice · Medium
- 4 Not solved yet. Format Table Rows and Money Amounts Practice · Easy
- 5 Not solved yet. Render a Text Table with Python 3.12 f-Strings Practice · Medium
- 6 When Not to Use an f-String Read
- 7 Branch on a Value with match and case Read
- 8 Not solved yet. Answer Chat Commands with match and case Practice · Easy
- 9 Not solved yet. Turn Status Codes into Labels with match Practice · Medium
- 10 Not solved yet. Match Lists and Dictionaries by Their Shape Practice · Medium
- 11 Not solved yet. Simplify Arithmetic Expressions with Class Patterns Practice · Medium
- 12 Not solved yet. Build an Event Router with Guards Practice · Medium
- 13 Not solved yet. Let mypy Catch a Missing Case with assert_never Practice · Hard
- 14 When to Use match Instead of if and elif Read
- 15 Not solved yet. Reuse a Computed Value with the Walrus Operator Practice · Medium
- 16 Not solved yet. Make Arguments Positional-Only or Keyword-Only Practice · Medium
- 17 Not solved yet. Decode a Config File with the Right Encoding Practice · Hard
- 18 Catch Several Exceptions Without Parentheses Read
- 19 Not solved yet. Escape HTML and Build SQL Parameters with t-Strings Practice · Hard
- 20 Flatten and Merge with Unpacking in Comprehensions Read
- 21 Speed Up Startup with Lazy Imports Read
- 22 Bring Old Python Code Up to Date Read
- 23 Write Code That Runs on Several Python Versions Read
Check yourself
5 questions · not saved while you're signed outUse these questions to check your understanding and compare explanations. Your score does not affect track completion.
What does this print?
Choose one answer to reveal the explanations. Answers are kept only while this page is open.
n = 42
print(f"{n=}")