Bird
0
0

How can you print multiple lines without extra blank lines using print()?

hard📝 Application Q9 of 15
Python - Input and Output
How can you print multiple lines without extra blank lines using print()?
AUse <code>end=''</code> to avoid newlines
BUse <code>print()</code> with multiple calls without parameters
CUse <code>print()</code> with <code>end='\n'</code> explicitly
DUse <code>sep='\n'</code> between values
Step-by-Step Solution
Solution:
  1. Step 1: Understand how to print multiple lines

    Using sep='\n' between multiple values prints each value on a new line without extra blank lines.
  2. Step 2: Compare other options

    end='' suppresses newline after print but does not add newlines between values. Multiple print calls add extra blank lines. end='\n' is default and adds newline after print.
  3. Final Answer:

    Use sep='\n' between values -> Option D
  4. Quick Check:

    sep='\n' prints values on separate lines cleanly [OK]
Quick Trick: Use sep='\n' to print values on separate lines [OK]
Common Mistakes:
MISTAKES
  • Using multiple print calls causing blank lines
  • Misusing end parameter to add newlines
  • Confusing sep and end roles

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes