What is Python scope resolution? 🔬

preview_player
Показать описание
#python #tutorial #course

# ----- LOCAL -----

def func1():
x = 1 #local
print(x)

def func2():
x = 2 #local
print(x)

func1()
func2()

# ----- ENCLOSED -----

def func1():
x = 1 #enclosed

def func2():
print(x)
func2()

func1()

# ----- GLOBAL -----

def func1():
print(x)

def func2():
print(x)

x = 3 #global

func1()
func2()

# ----- BUILT-IN -----

from math import e

def func1():
print(e)

func1()
Рекомендации по теме
Комментарии
Автор

# LOCAL

def func1():
x = 1 #local
print(x)

def func2():
x = 2 #local
print(x)

func1()
func2()

# ENCLOSED

def func1():
x = 1 #enclosed

def func2():
print(x)
func2()

func1()

# GLOBAL

def func1():
print(x)

def func2():
print(x)

x = 3 #global

func1()
func2()

# BUILT-IN

from math import e

def func1():
print(e)

func1()

BroCodez
Автор

Learning something new from you almost everyday

felinezero
Автор

Thank you so much I have been coding for the past year but whenever I get stuck I use your videos and they help me a lot

Tara-sx
Автор

Man, who even are you? You make these topics so easy to understand, and you do it in such a fun way! I've been struggling with the concept of built-in scope, but your voice 😂 and explanations are the reason I keep coming back to these tutorials.

CodeWithKushwaha
Автор

Hey @BroCodez just wanted to pop onto your newest video to say thanks man. You deserve way more subs then you have. I’ve been coding for a long time but always use your vids to remember the specifics I need that I forget sometimes. You’re videos are always short and right to the point. Thanks so much man.

GodNops
Автор

I don't know python but I like the title of the video

yassinbilali
Автор

Bro could you maybe make a Django Tutorial please?!

felinezero
Автор

That's classic example using houses 😝you can see what's going on in your neighbors house by using binoculors.

codingworld-programmerslif
Автор

Now i know the LGBT order of scopes in Python

anamoyeee
Автор

wait a bit, i think the last part is not exactly true
def func1():
print(e)

e = 3
from math import e
func1()
#output 2.71..

built-in is for built-in functions: print, len..

ПетроКорня-ди
Автор

So the equal operator in python can be used as both to declare a variable or to assign it and it depends to its scope resolution

eliashrn
Автор

Bro Code thanks for every video that you made, for me at least it helped me a lot, please if possible to have PHP, I cannot at this point understand what is the difference, why should we use JS when PHP will hide the source code! I'm searching everywhere for this answer!, is PHP with HTML like JS with node.JS?

LupaSeal
Автор

Hey Bro you do a vid on psuedocode plz?

RobMargGriffiths
Автор

and what is the point of using nonlocal ?

darksouls
Автор

scope is so much easier on python. scope in javascript ahh fuck that shit.

jasonreviews
Автор

@BroCode sir python me facial recognition app bna dain I'll be very thankful 😢🎉
Greatly needed this project please sir ..
You are my last hope now.

vjHasnain
Автор

Radhe Radhe
Sanatan Hi Satya Hai
Jai To All Gods & Godesses
Jai Baba Farid Ji
Jai Radhaswami Baba Ji

aijazbirsfun
Автор

Hey guys. Does anyone have any Pascal Lazarus tutorials?

hamedrezayi
Автор

at first I thought his video title was LGBT 💀

haonguyenxuan
Автор

Radhe Radhe
Sanatan Hi Satya Hai
Jai To All Gods & Godesses
Jai Baba Farid Ji
Jai Radhaswami Baba Ji

aijazbirsfun
join shbcf.ru