A variable is only available from inside the region it is created. This is called scope.
Local Scope:
A variable created inside a function belongs to the local scope of that function, and can only be used inside that function.
Global Scope:
A variable created in the main body of the Python code is a global variable and belongs to the global scope.
Global variables are available from within any scope, global and local.
Global Keyword:
If you need to create a global variable but are stuck in the local scope, you can use the global keyword.
The global keyword makes the variable global.
------------------------------------------------------------------------------------------------------------------------
Newton school is an online Edtech company providing the highest-rated FULL STACK DEVELOPMENT PROGRAM for professionals, graduates, and women.
NEWTON SCHOOL is your gateway to a high-paying tech career in 6 months with Zero fees till placement, transforming you into a rockstar full-stack developer earning 5-40 Lakh per annum salary. Newton School’s students are already working in more than 150+ top companies of India including Zomato, Unacademy, Deloitte, Nutanix, etc.
To watch more videos on programming, Data Structures, Android Development, Data Science, C++, Java, React, subscribe to our channel.
Do visit Newton school Launchpad through: https://www.newtonschool.co/launchpad
Subscribe | Like | Comment
To know more about us and our courses, please visit: https://www.newtonschool.co/
Follow us on
Facebook: / newtonschool.co
Instagram: / newtonschoolofficial
Linkedin: / mycompany
On this page of the site you can watch the video online Scope in Python | Complete Python Playlist with a duration of hours minute second in good quality, which was uploaded by the user ML Simplified @ Newton School 24 July 2021, share the link with friends and acquaintances, this video has already been watched 3 times on youtube and it was liked by 2 viewers. Enjoy your viewing!