Bird
0
0

Which of the following print() statements will print the text exactly as: Hello,World! without any spaces?

easy📝 Conceptual Q2 of 15
Python - Input and Output
Which of the following print() statements will print the text exactly as: Hello,World! without any spaces?
Aprint('Hello,', 'World!')
Bprint('Hello,', 'World!', sep=' ')
Cprint('Hello,' + 'World!')
Dprint('Hello,', 'World!', sep='\n')
Step-by-Step Solution
Solution:
  1. Step 1: Analyze each print statement

    print('Hello,', 'World!') prints with default space separator, so output is 'Hello, World!'. print('Hello,' + 'World!') concatenates strings before printing, so output is 'Hello,World!'. print('Hello,', 'World!', sep=' ') uses space separator explicitly, same as default. print('Hello,', 'World!', sep='\n') uses newline separator, so output is on two lines.
  2. Step 2: Identify which matches the exact output

    Only print('Hello,' + 'World!') prints 'Hello,World!' without spaces.
  3. Final Answer:

    print('Hello,' + 'World!') -> Option C
  4. Quick Check:

    String concatenation removes spaces [OK]
Quick Trick: Use + to join strings without spaces [OK]
Common Mistakes:
MISTAKES
  • Assuming comma joins without space
  • Using sep=' ' adds space
  • Confusing separator with concatenation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes