Тёмный

How to fix unbound local error in python 

Make Data Useful
Подписаться 32 тыс.
Просмотров 1,9 тыс.
50% 1

🐍💡 How to Fix UnboundLocalError in Python | Make Data Useful 💡🐍
Struggling with the UnboundLocalError in Python? You're not alone! This common error can stump many programmers, from beginners to those with more experience. But don't worry, Make Data Useful is here to help you understand and resolve this issue in no time!
🎬 In today's video, we'll dive into:
What UnboundLocalError is and why it occurs
How Python's variable scope affects your code
Step-by-step solutions to fix the error
Best practices to avoid this error in your future coding projects
👩‍💻 Whether you're working on a small script or a large project, understanding variable scope is crucial for bug-free code. We'll show you how to navigate these tricky waters with ease.
Read more on the official docs: docs.python.or...

Опубликовано:

 

2 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 3   
@augustuss2927
@augustuss2927 8 месяцев назад
Hey, cool video! What I still don't get. How does Python read the code? In what order? Because I would expect it to just print x as global and only afterwards discover "Oh now theres a local x" and if I would then have another print (x) function it would print that one. But it seems like the whole code is run, and python basically says "Well, I know you will add a local variable later, but you need to do it now, so I am not gonna execute the code until you fix it." I dont get it.
@MakeDataUseful
@MakeDataUseful 8 месяцев назад
It's a VERY good question, there's a really great video all about this by one of my favourite channels mCoding where he goes into a little more detail. You have inspired me to do a deep dive video and nerd out on the topic because you're right it doesn't feel “natural”. Thanks for dropping in and commenting!
@augustuss2927
@augustuss2927 7 месяцев назад
​@@MakeDataUseful That's great! I am surprised that I cannot find anything on it tbh. I just started coding and it seems like such a natural question to ask.
Далее
python 3.13 release highlights
49:56
Просмотров 18 тыс.
Китайка стучится Домой😂😆
00:18
Being Competent With Coding Is More Fun
11:13
Просмотров 86 тыс.
Writing Code That Runs FAST on a GPU
15:32
Просмотров 560 тыс.
ChatGPT Vision API
5:18
Просмотров 6 тыс.
Meta llama 3 unexpected results! 100 prompt test
16:19
Просмотров 2,6 тыс.
Python 101: Learn the 5 Must-Know Concepts
20:00
Просмотров 1,2 млн
Китайка стучится Домой😂😆
00:18