What are local variables and global variables in Python?
Unlike global variables, which can be used everywhere in the programme, local variables can only be accessible within the function or module in which they are defined. Global variables in Python can be defined with the global keyword, and they can also be modified in a local context.
Python local variables are those that are defined inside a function but have a scope that is specific to that function only as opposed to global variables, which are defined outside of any function and have a global scope.
Python Global variables are those which are not defined inside any function and have a global scope whereas Python local variables are those which are defined inside a function and their scope is limited to that function only.