Skip to content

PRO TIP Block youtube.com at the DNS level β€” Pi-hole, NextDNS or your hosts file β€” but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

Python Scope tutorial for Beginners

17.9K views on YouTube

Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap

In this Python Scope tutorial for beginners, you will learn about global and local scope and how they impact your Python code. You will also learn about nested functions and the global and nonlocal keywords.

πŸ’– Support me on Patreon ➜ https://patreon.com/davegray

⭐ Become a full-stack dev with Zero To Mastery Courses:
– The Complete Python Developer: https://bit.ly/CompPythonDev
– Complete Machine Learning & Data Science: https://bit.ly/CompMachineLearning
– Junior to Senior Dev Roadmap: https://bit.ly/WebDevRoadmap-JrtoSr

🚩 Subscribe ➜ https://bit.ly/3nGHmNn

πŸ“¬ Course Updates ➜ https://courses.davegray.codes/

❓ Questions – Please post them to my Discord ➜ https://discord.gg/neKghyefqh

β˜• Buy Me A Coffee ➜ https://www.buymeacoffee.com/davegray

πŸ‘‡ Follow Me On Social Media:
Github: https://github.com/gitdagray
Twitter: https://twitter.com/yesdavidgray
LinkedIn: https://www.linkedin.com/in/davidagray/

πŸ”— Source Code: https://github.com/gitdagray/python-course

πŸ”— Playlist for this Python Course: https://bit.ly/dg-beginners-python

Python Scope tutorial for Beginners

(00:00) Intro
(00:05) Welcome
(00:13) Create a file
(00:25) global scope vs local scope
(03:37) Parameters override globals of the same name
(04:45) Review of global vs local scope
(05:13) Scope applies to functions, too
(06:14) Nested Functions
(08:19) Why create Nested Functions?
(09:42) The global keyword
(13:09) The nonlocal keyword
(14:23) Applying what we’ve learned

πŸ“š Tutorial References:
πŸ”— Python Official Site: https://www.python.org/
πŸ”—Visual Studio Code Official Site: https://code.visualstudio.com/

Was this Python Scope tutorial for beginners helpful? If so, please share. Let me know your thoughts in the comments.

#python #scope #tutorial