The quiz where the difficulty automagically adapts to the player's Python knowledge
This is a question page. You can use this page to bookmark a question. Start a new quiz!
Question #357
result = 0
def find_sum(num1, num2):
if num1 != num2:
result = num1+num2
else:
result = 2*(num1+num2)
find_sum(3, 4)
print(result)
find_sum(5, 5)
print(result)
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. (w3schools.com/python/gloss_python_global_variables.asp)
Question difficulty: 🔵🔵🔵🔵🔵