QUESTION IMAGE
Question
for the function below, which variables have the same scope?
def square(numa, numb):
return numa ** numb
base = 5
power = 2
answer = square (base,power)
print(answer)
numa and power
numb and power
base and numa
In Python, numA and numB are local variables within the square function. base, power, and answer are in the global (or outer - scope in this simple context). Variables numB and power have different scopes as one is local to the function and the other is in the outer - scope. Similarly for numA and base or numA and power. There are no correct pairs among the options as local and non - local variables have different scopes.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
None of the above options are correct.