World's Best AI Learning Platform with profoundly Demanding Certification Programs
Designed by IITians, only for AI Learners.
What does the Keyword "nonlocal" do in Python 3?
The keyword "nonlocal" in Python 3 is used to access a variable defined in an outer, but not global, scope in a function. It is similar to the "global" keyword, but instead of accessing a global variable, it allows the function to access a variable in an outer scope. This can be useful when working with nested functions that need to modify a variable in an outer scope, but not a global scope. Without the "nonlocal" keyword, the variable would be treated as a local variable within the nested function.
Running random forest algorithm with one variable