Create a Formatted Table Row
Beginner · Write the code · from Python String Formatting: f-strings, format(), and % Operator
From the lesson: Python String Formatting: f-strings, format(), and % Operator
Imagine you're building a receipt for a coffee shop. You need to combine a product name, a price, and a quantity into one clean line. You could glue strings together with +, but it gets messy fast.
Read the lessonCreate three variables: name = "Alice", score = 95.8, and grade = "A+". Print a formatted table row where:
Expected output (the | characters are part of the output):
| Alice | 95.8 | A+ |# Create the variables and print the formatted table row
More String Formatting exercises
- Format a Receipt LineBeginner
- Format a Large Number with CommasBeginner
- Fix the Broken f-stringBeginner
- Generate a Personalized Email GreetingBeginner
All Python exercises · 50 practice problems · Python Fundamentals quiz