165k views
5 votes
Why do numA and numB have the same scope in the subtract function? def subtract(numA, numB): return numA - numB def divide(numC, numD): return numC / numD answer = subtract(24,6) print (answer)

1 Answer

1 vote

Answer:

The output of the subtract method is "18".

Step-by-step explanation:

In the above-given code, two methods "subtract and divide" is declared, that accepts two variable in its parameter, and method work with there respective names.

In this code, the subtract method accepts two-variable "numA and numB", within the same scope because it helps the method in proper functioning, and if the variable is no defined in the scope it will give an error.

User Maeve
by
4.6k points