Question: Would option A be right ? Question 7 def display_variable(): print(var) def main(): var = Hello display_variable( main( This code will result in an error
Question 7 def display_variable(): print(var) def main(): var = "Hello" display_variable( main( This code will result in an error NameError: name ' 'var' is not defined Why did the error occur? Variables cannot be defined after calling a function. Global variables cannot generally be used inside a function. Functions cannot access the local variables of other functions. Functions cannot be called within another function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
