Question Detail
Question
Based on the provided Python quizzes (page 12), what would be the output or outcome of the following code snippet if run in a Python 3 environment?
sum = lambda a,b : a+b
print (sum(5,6))
print sum(10,30)
Correct Answer
Option C is the correct answer.
Detailed Explanation
In Python 3,
print is a function and requires parentheses. The line print sum(10,30) uses Python 2 syntax for the print statement, which would result in a Syntax Error in Python 3. The first line print (sum(5,6)) would correctly output 11.
Hint
Pay close attention to Python's version-specific syntax, especially for built-in functions.