Post

@Python_Dv B. Error. The variable num is local to the fun1 function. This means it is out of scope (i.e. inaccessible) outside of that function block.
English

@Python_Dv Option B : Error
variable num is defined inside a function and it's scope is limited to fun1.
Outside if we try to access num it will throw an error.
English

@Python_Dv The answer is B: Error ✅
Why?
num is only defined as a parameter inside fun1.
After calling fun1(5), the returned value is not stored anywhere.
Then print(num) tries to access num in the global scope, but it does not exist there.
So Python raises a NameError.
English

@Python_Dv Error. "num" is a local variable, so inaccesible out of the function. To print the result of the function "fun1", it should be good to change line 2 with <print(num + 25)> (without angle brackets) and delete line 5.
English

@Python_Dv Error.
num is a local variable and exists only in the function fun1, therefore, when it is called outside the function, it will result in error.
English

@Python_Dv B: NameError. Core Python scoping. Even CPython's bytecode can't touch locals outside their frame.
English

@Python_Dv Error number a local variable which works inside the function
English







