Skip to main content
Loading page…
Python Mastery
Chapter 3
Lesson 4 of 4
f-strings & Formatting
Contents
Notes
Tutor
Concept
f-strings: The Modern Way to Embed Values
Loading activity…
Previous
1 / 9
Continue
Contents
Notes
Discussion
Tutor
28 min
9 activities
0 of 9 done
In this lesson
1
f-strings: The Modern Way to Embed Values
2
Format Specifiers: Controlling the Appearance
3
Conversion Flags and Debugging with =
4
When to Use format() and % Formatting
5
Pretty-Printing a Report Table
6
f-string Format Spec Quiz
7
Format a Receipt
8
Pitfall: Floats and Rounding Display vs Actual Value
9
Choosing the Right Formatting Tool
Objectives
Learner can embed variables and expressions inside f-strings
Learner can apply format specifiers to control decimal places, width, alignment, and thousands separators
Learner can use the !r conversion flag and write multi-line f-strings
Learner can decide when to use f-strings versus str.format() or % formatting
Chapter 3 · Working with Strings
String Basics & Immutability
Indexing & Slicing
Essential String Methods
f-strings & Formatting
Previous: Essential String Methods
Next: Lists: The Workhorse