Question Detail

COS 102 Python strings Objective Question

Question

What is the output of the Python expression "5" + "5"?
Options
A 10
B "10"
C "55"
Correct Answer
D An error
Correct Answer

Option C is the correct answer.

Detailed Explanation

When two strings are concatenated using the '+' operator, they are joined character by character. So, '5' + '5' becomes '55', not the numerical sum.

Hint

Remember that these are strings, not numbers, even though they look like digits.

Question Info