In this Python course video discussed the concept of scope in Python, which refers to the region of the code where a variable is defined and can be accessed. You can also learn about the LEGB (Local, Enclosing, Global, Built-in) rule, which specifies the order in which Python searches for a variable in different scopes.
Here are examples that demonstrated how the LEGB rule works in Python, including examples of local scope, enclosing scope, global scope, and built-in scope. Also an example of using the global keyword to modify a global variable inside a function, and an example of using the nonlocal keyword to access and modify a variable in the enclosing scope of a nested function.
NEXT VIDEO TO WATCH:
Will be available - 08.03.2023
TIMESTAMPS:
0:00 - Intro
0:45 - What are scopes in Python?
1:52 - What is local scope in Python
4:25 - What is enclosing scope in Python
6:08 - What is global scope in Python
9:10 - What is the built-in scope in Python
9:53 - Greate global and nonlocal variables inside the Python function
ABOUT MY CHANNEL
In my channel, you can find explainers and tutorials about programming and technology.
The topics are for different skills and levels, from beginners to professionals.
/ @explainit1024
Don’t forget to subscribe!
CHECK OUT OTHER VIDEOS ABOUT GIT:
• Learn GIT Basics in an hour!
CHECK OUT PYTHON TUTORIALS:
• Python tutorial for beginners 1. How to in...
Auf dieser Seite können Sie das Online-Video Python tutorial for beginners 13. Scopes mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer ExplainIT 17 Februar 2023 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 27 Mal angesehen und es wurde von 5 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!