Practice - Example of Formatting with f
Practice Questions
Test your understanding with targeted questions
What does the print function do by default?
💡 Hint: Think about what happens when you call print('text') without any additional parameters.
How do you change the separator in print?
💡 Hint: Remember the code syntax for print.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What does the print function use by default to separate arguments?
💡 Hint: Consider the default output of print without any modifications.
Can you replace placeholders in a string using their name?
💡 Hint: Think of a dictionary where you refer to values by their keys.
2 more questions available
Challenge Problems
Push your limits with advanced challenges
Create a formatted string that outputs the following for a student with a name and score: 'Student John scored 85/100 in Mathematics.' Use both positional and named formatting.
💡 Hint: Think about where to place the student's name and score in the string.
Write a small program using f-strings to print a floating-point number with 1 decimal place and aligned to the right within a 5-character width.
💡 Hint: Familiarize yourself with f-string formatting syntax for alignment.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.