If you want to make a variable defined in an outer function accessible to an inner function, you use the _______ keyword.
- global
- inner
- outer
- public
To make a variable defined in an outer function accessible to an inner function, you use the 'global' keyword. It indicates that the variable should be treated as a global variable.
Loading...
Related Quiz
- The ____ keyword in Python is used to define conditions under which a block of code will be executed.
- You are developing a RESTful API and need to ensure that sensitive user data is secure during transit. Which approach would you use to secure data transmission?
- In a multi-level inheritance scenario, you notice that the derived class is not behaving as expected when a method is called. You suspect that there's confusion with method overriding from multiple base classes. How might you diagnose this?
- In object-oriented programming in Python, ____ refers to the class that a class inherits from.
- In Python, how do you define a method inside a class to access and modify the objects’ attributes?