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

Would option A be right ?
Would option A be right ? Question 7 def display_variable(): print(var) def

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!