Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

for the function below, which variables have the same scope? def square…

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

Explanation:

Brief Explanations

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.

Answer:

None of the above options are correct.