Question Detail
Question
Consider the Python code:
x = 5, y = "John", print(x + y). What will be the outcome when this code is executed?
Correct Answer
Option D is the correct answer.
Detailed Explanation
Page 34 explains, 'If you try to combine a string and a number, Python will give you an error.' This is a runtime error because the operation
+ is defined differently for numbers (addition) and strings (concatenation), and cannot implicitly handle a mix.
Hint
Look at the examples on page 34 regarding combining different data types with the '+' operator for output.