Question Detail

COS 102 Python strings Objective Question

Question

Consider the following Python code snippet:
first = "Data"
second = "Science"
result = first + second
What will be the value of result?
Options
A "Data Science"
B "DataScience"
Correct Answer
C "Data+Science"
D An error will occur
Correct Answer

Option B is the correct answer.

Detailed Explanation

The '+' operator for strings (concatenation) joins strings directly without adding spaces automatically. To include a space, it must be explicitly added.

Hint

Remember the 'No Space' Rule for concatenation.

Question Info