Question #357

What is the output of the code snippet below?
result = 0

def find_sum(num1, num2):
    if num1 != num2:
        result = num1+num2
        result = 2*(num1+num2)
find_sum(3, 4)
find_sum(5, 5)

In both calls of the find_sum() function, result is only modified within the scope of the function (it doesn't have the global keyword). Within the scope of the module, result still equals to 0. (

Comment on Disqus:

Question difficulty: 🔵🔵🔵🔵🔵