In Python loop variable keeps the last value after the loop is over. You may want to know about.

preview_player
Показать описание
The loop variable keeps the last value after the loop is over. You may want to know about this behaviour, but it is better not to count on this in real programs.

#loop #cycle
#python #python3 #development #developer #programming #it #coding #program #programmer #programminglanguage #code #coding #pythonprogramming #pythoncode #software
#softwaredeveloper #geek #computers #learntocode #learnpython
Рекомендации по теме
Комментарии
Автор

it doesnt "keep" the value lol, its just that the variable is actually defined In the outher scope

kamilkarwacki
Автор

youtube pls no, i just wanted to install linux man, plls

rzlegendszelda
Автор

Variable will keep the last value if it's not declared inside loop ugh, what's new in it?

xpertcrush
Автор

This caught me out yesterday, very good to be aware of.

ryancodrai
Автор

That was "super easy, barely an inconvenience!" - Ryan George

marckant
Автор

You can just do colours[-1] at the end

canaDavid
Автор

Do you teach haskell or elixir? I really don't find any websites, free ebooks or too many tutorials on youtube.

Human_ver-..
Автор

So basic... Can you do something on closures or writing your own python decorators

boomer_money
Автор

What!? I get it but I would never have expected that

ChristopherRucinski
Автор

Is there anyone gonna talk about iterator protocol? 😆

GodotEnjoyer
Автор

In JavaScript:
For (___ of ____){
}
In Phyton
For ___ in ____:

They are pretty similar, and i thinks that every coding language are pretty similar

catmoon
visit shbcf.ru