Python print() Practice Questions for Beginners
Chapter 2 Recap and Practice
You now know how to show almost anything on the screen. Here is the whole chapter in one table:
| You write | It does |
|---|---|
print("text") | shows text; quotes mark where it starts and ends |
print(25) | shows a number; numbers need no quotes |
print("a", "b") | shows several items with one space between them |
print(5 + 3) | calculates first, then shows the answer |
\n | starts a new line inside text |
\t | jumps to the next tab stop, to line up columns |
\' and \" | print a quote inside text |
\\ | prints one backslash |
sep="-" | changes what goes between the items |
end=" " | changes what comes after the last item |
"""…""" | text over many lines, with any quotes inside |
And the three errors to look for first: missing quotes, missing brackets, and capital letters (Print instead of print).
Practice questions
Write each program yourself, press Run to try it, and Submit when it's ready. Start with the easy ones.
The print() function
- 13.Python Program to Print Multiple LinesEasySolve
- 2.Python Program to Print a Phone Number Without QuotesEasySolve
- 3.Python Program to Print a String and a Number TogetherEasySolve
- 4.Python Program to Print a Message and a Calculation in One LineEasySolve
Escape sequences
- 5.Python Program to Print Multiple Lines with One print()EasySolve
- 6.Python Program to Create a Name Card Using TabsEasySolve
- 7.Python Program to Print Nested Quotes with Escape CharactersEasySolve
- 14.Python Program to Print Escape Sequences as TextEasySolve
- 11.Python Program to Print a Digital ReceiptMediumSolve
sep and end
- 8.Python Program to Print Details Separated by CommasEasySolve
- 9.Python Program to Print One Line with Several print() CallsEasySolve
- 15.Python Program to Print a List with sep and endMediumSolve
Triple quotes
- 10.Python Program to Print Multiple Lines Without Escape SequencesEasySolve
- 12.Python Program to Print a Console DashboardHardSolve
Common errors
- 28.Fix the print() Errors in a Greeting ProgramEasySolve
- 29.Fix the print() Errors in a Receipt HeaderMediumSolve
You can now make Python say anything, in any shape. Next, you'll learn to think like a programmer.