Bird
0
0

Why does this code print HelloWorld without space?

hard📝 Conceptual Q10 of 15
Python - Basics and Execution Environment
Why does this code print HelloWorld without space?
print("Hello" + "World")
ABecause Python ignores spaces inside quotes
BBecause + joins strings exactly without adding spaces
CBecause strings need commas to add spaces
DBecause print removes spaces automatically
Step-by-Step Solution
Solution:
  1. Step 1: Understand string concatenation with + operator

    The + operator joins strings exactly as they are, no extra spaces added.
  2. Step 2: Explain why no space appears

    Since no space is included between "Hello" and "World", the output is "HelloWorld".
  3. Final Answer:

    Because + joins strings exactly without adding spaces -> Option B
  4. Quick Check:

    + joins strings exactly, no spaces added [OK]
Quick Trick: Add spaces explicitly when joining strings with + [OK]
Common Mistakes:
MISTAKES
  • Assuming print adds spaces
  • Using commas instead of + for concatenation
  • Thinking spaces inside quotes are ignored

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes