GLOBAL & LOCAL VARIABLE - PYTHON PROGRAMMING

  Рет қаралды 94,211

Sundeep Saradhi Kanthety

Sundeep Saradhi Kanthety

5 жыл бұрын

GLOBAL VARIABLE : A variable declared outside of the function or in global scope is known as global variable. This means, global variable can be accessed inside or outside of the function.
LOCAL VARIABLE : A local variable is a variable which is either a variable declared within the function or is an argument passed to a function.

Пікірлер: 103
@pythonthepythonist6439
@pythonthepythonist6439 2 жыл бұрын
My Software transition started after watching your videos, people like you make a lot of difference to the world, i watch many people videos but the better clarity comes when i watch yours.
@unitech23
@unitech23 9 ай бұрын
I've watched many different teachers but you truly explain it in a way a child can learn. Thank you so much for sharing with us all your gift of teaching.
@sivakarthiksiva4739
@sivakarthiksiva4739 3 жыл бұрын
best teaching skill you have.....love from my heart
@budaykumarrao7612
@budaykumarrao7612 3 жыл бұрын
U gived a one of the best performance We understood easily Thank you sir
@kdeepak4446
@kdeepak4446 4 жыл бұрын
You are the best teacher 🙏 sir..keep uploading more videos
@jayanth01
@jayanth01 Жыл бұрын
Thank you for your teaching sir Concept cleared
@anshulpant9270
@anshulpant9270 3 жыл бұрын
this concept is very difficult to teach but appreciate you work you have done a great job.. everything is cleared ..thank you so much sir... appreciate that
@seraphcarrier5241
@seraphcarrier5241 2 жыл бұрын
I know these things. Just here to master it. Is all.
@vijay-ei8xz
@vijay-ei8xz 3 жыл бұрын
Thankyou sir with very easy you explained this topic ♥️
@angelthedecentgirl7181
@angelthedecentgirl7181 2 жыл бұрын
Aamzing explanation sir! You are the best! Thank ytou so much Sir.
@krishnakanthsudhakar-hx2nt
@krishnakanthsudhakar-hx2nt Жыл бұрын
your teaching is beautiful sir
@anushreejoshi1829
@anushreejoshi1829 Жыл бұрын
Thankyou so much sir...uh are amazing....Everything is cleared...💯
@ritamdutta8098
@ritamdutta8098 9 ай бұрын
excellent way of teaching
@dawitkefyalew2618
@dawitkefyalew2618 6 ай бұрын
Good job, thank you so much. Now I understand the difference between them.
@arunakumari328
@arunakumari328 3 жыл бұрын
Sir classes are simply awesome 👌sir
@ot7ismyreligion
@ot7ismyreligion Жыл бұрын
amazing sir...i understood the concept which i had been struggling with
@jojven7514
@jojven7514 2 жыл бұрын
THANK YOU SIR FOR MAKING VDO ON THIS TOPIC 🙏🙏🙏😇😇😇
@saranyapampana134
@saranyapampana134 Жыл бұрын
guys trust me he is amazing. Just a tip watch the video at 1.25X speed but it's up to you.
@jatindersingh2241
@jatindersingh2241 3 жыл бұрын
very well explained ,Thanks
@user-ve6sw3jb3u
@user-ve6sw3jb3u 3 ай бұрын
Hello, why a=40 is local if it’s declared outside the function?
@user-le5ye7pk3p
@user-le5ye7pk3p Жыл бұрын
sir u r voice very sweet best teacher skill ever
@pawangoled9622
@pawangoled9622 Жыл бұрын
If we intialize the variable after the user defined function what will be the value of a?
@sayraislive5330
@sayraislive5330 4 жыл бұрын
Sir, How you got your video on too of KZbin search
@priyankagoud1736
@priyankagoud1736 2 жыл бұрын
Thanks for the clear cut video
@manirock6216
@manirock6216 4 жыл бұрын
error local variable 'config_ referenced before assignment how to solve this
@princeowusuansah5031
@princeowusuansah5031 Жыл бұрын
Please why is a=40 a local variable and not global Because I thought a=40 was not part of the def display() function.
@abuchiemmanuelugwuoke3208
@abuchiemmanuelugwuoke3208 2 жыл бұрын
Thank you so much this was so helpful
@billyboy_679
@billyboy_679 4 ай бұрын
Absolute Legend..
@krishnapulimi9402
@krishnapulimi9402 5 жыл бұрын
Very clear to explain sir... thank you sir Programs only written sir, Please see the execution also
@KOTHAABHISHEK
@KOTHAABHISHEK 3 жыл бұрын
You missed two things bro 1) we can change the value of global variable from the function using global keyword 2)we can call the global variable from function when both having same name by using globals()
@santoshkumarkar39
@santoshkumarkar39 2 жыл бұрын
Very very good
@thriambakm5400
@thriambakm5400 4 жыл бұрын
Sir can you teach me program based on matrix in python
@d240deepak3
@d240deepak3 3 жыл бұрын
Super explanation
@akashjulius4445
@akashjulius4445 Жыл бұрын
love from pakistan great teacher
@priyadharshiniveeranthiran4329
@priyadharshiniveeranthiran4329 4 жыл бұрын
Thank you sir.I know more with this session and it is very easy for understand
@Greennuts
@Greennuts 3 жыл бұрын
i love u from bottom of my heart
@reshmaittiachan5489
@reshmaittiachan5489 5 жыл бұрын
good explanation :-)
@vignesh.s6829
@vignesh.s6829 2 жыл бұрын
Keep doing 🔥✨
@somethingnew4703
@somethingnew4703 2 жыл бұрын
Sir local and global variables lo same names icchinappudu first prefeerence local variable ki ivvali ani chepparu kada sir kaani maa sir first preference highest value ki ivvali ani chepparu idi correct yena sir
@taonachinhamo4790
@taonachinhamo4790 Жыл бұрын
🔥🔥🔥 thank u!
@chandanrajanna705
@chandanrajanna705 4 жыл бұрын
good one
@chennupatiharika9863
@chennupatiharika9863 3 жыл бұрын
Sir as u said in structure of a c program.we have to write user defined function after the completion of main function so,here in this concept u discussed like main function will come after the user defined function....so..here I have doubt like both are same or not......?
@sundeepsaradhi
@sundeepsaradhi 3 жыл бұрын
Hi First we have to write user-defined function and then we have to write function call.
@chennupatiharika9863
@chennupatiharika9863 3 жыл бұрын
@@sundeepsaradhi helpfull......tq sir
@kanusuya8712
@kanusuya8712 4 жыл бұрын
Super sir.. U explained very clearly.. We can easily understand your teaching method..
@hocminergaming4015
@hocminergaming4015 2 жыл бұрын
really helpfull sir
@sajisebastian1586
@sajisebastian1586 4 жыл бұрын
When global and local variable with same name, how can I access global variable from local scope area
@AjayJain-ef2mz
@AjayJain-ef2mz 4 жыл бұрын
hey i think i can solve your problem. #creating a global variable a = 10 def prnt(): #creating a local variable a=20 #Now we want to access 'a' with value 10 x = globals()['a'] print(x) #this will print 10 globals()['a'] = 20 #value of global variable a has been changed to 20
@13naaz
@13naaz Жыл бұрын
LEGB rule is missing sir.. global and globals keywords explanation..
@praveenkumar3040
@praveenkumar3040 9 ай бұрын
nice sir
@KalyanKumar-tt9hh
@KalyanKumar-tt9hh 2 жыл бұрын
Main function ki oka local variable vundhi, User defined function ki oka local Variable vundhi...Execute chesthe output ga ey variable vasthundhi
@siyaborker9904
@siyaborker9904 Жыл бұрын
why is c a local variable? it is defined in the main right
@yogeerao9149
@yogeerao9149 Жыл бұрын
Can you please make one video about "How Python Manage Memory" Thanks in Advance
@venkym3148
@venkym3148 5 жыл бұрын
Sir still how many videos left for entire python course??
@Greennuts
@Greennuts 3 жыл бұрын
thank u sir
@murthyariga4689
@murthyariga4689 3 жыл бұрын
Hi Sir @Sundeep Saradhi Kanthety, I have a function which has a variable "X", can I use the same variable X out side the function ?
@sundeepsaradhi
@sundeepsaradhi 3 жыл бұрын
Hi Yes you can use
@murthyariga4689
@murthyariga4689 3 жыл бұрын
@@sundeepsaradhi okay thank you
@digitalduniyag.a2748
@digitalduniyag.a2748 4 жыл бұрын
Sir you are great .. But sir pleae upload one video regarding main and user define function ... How can we diffrentiate between them. .. And how would we use both in one progam
@muruga30
@muruga30 4 жыл бұрын
Example: #1 def add(): #2 a=10 #3 b=20 #4 print(a+b) #5 add() #6 print("End") A user defined function ends with : ,that is function header. After colon (:) the statements are pressed with space that is Indentation that is function body. Here the line #1,#2,#3,#4 are user defined function. #5 and #6 doesn't have any indentations. That is main program or top level statements
@_weebxarmy_2009
@_weebxarmy_2009 2 жыл бұрын
Great explanation thank you so much sir
@shinimannan
@shinimannan 4 жыл бұрын
Sir, great session, Thanks. Have a very basic question. Have not understood what is the use of the line -> def display ( ): in the user defined function and the line -> display( ) in the main function.
@chennupatiharika9863
@chennupatiharika9863 3 жыл бұрын
Def display: definition section..... I.e fun definition Display:main function section I.e fun call
@samiyabanu3792
@samiyabanu3792 Жыл бұрын
Thank you so much sir 💖
@muruga30
@muruga30 4 жыл бұрын
a=10 # global def disp(): print(a) def show(): a=20 # local print(a) # o/p =20 =>here I want to access global var a. Is possible in python.
@sathishyerraguntla8099
@sathishyerraguntla8099 3 жыл бұрын
yes it is possible
@Mrbeansololover
@Mrbeansololover 3 жыл бұрын
a=10 #global def disp(): print(a) def show() a=20 a= globals ()['a'] print(a) #with the use globals () we can get the global variable instead of local variable
@Mrbeansololover
@Mrbeansololover 3 жыл бұрын
Here it will print global variable
@jeetendranathmishra3701
@jeetendranathmishra3701 3 жыл бұрын
Sir can you please make a video on global keyword.
@d.sairamdronamraju1555
@d.sairamdronamraju1555 3 жыл бұрын
Thank you sir
@hanu-tw3js
@hanu-tw3js 4 жыл бұрын
Sir after calling function we some a=10 a is global or local variable because it is out side the function???
@rajeshkumar-rg9id
@rajeshkumar-rg9id 4 жыл бұрын
Hi sir,in user defined function instead print i think we need to write return?
@beetlenut6980
@beetlenut6980 3 жыл бұрын
Not necessarily, In case you want the program to return some value you should not write print For example: def addNum(num1, num2): print(num1 + num2) addNum(2, 3) Output: 5 What happened here is the function just prints something to screen for this example it's 5, Now if you want this result to store in a variable it's not gonna work out so that's where return comes in. def addNum(num1, num2): return num1+num2 answer = addNum(2,3) print (answer) Here you can assign the function answer into an variable so that you can use it later :)
@sainani3664
@sainani3664 5 жыл бұрын
Pls do videos on practice programs on evry topic with explanations...
@s.santhosh4668
@s.santhosh4668 3 жыл бұрын
Thankyou sir😁
@NandWebDev
@NandWebDev 4 жыл бұрын
vera level mama neenga
@naganaboyinalakshmivenkate5177
@naganaboyinalakshmivenkate5177 Жыл бұрын
sir pls explain the topics with matter
@tanmaypandey9133
@tanmaypandey9133 5 жыл бұрын
SIR I HAVE A DOUBT ABOUT FACTORIAL OF A NUMBER IN WHILE LOOP AND FOR LOOP.
@chetanshukla5851
@chetanshukla5851 4 жыл бұрын
Nice explaination sir Thank you sir
@HimanshuKumarAN
@HimanshuKumarAN 4 жыл бұрын
Sir why is local variable preffered over global variable? If both have same name. sir please help .
@chennupatiharika9863
@chennupatiharika9863 3 жыл бұрын
Local variable:these variables are restricted in tht particular function..i.e.we can access these local variable only tht where we declared tht variable... Global variables:we access these global variables entire the program.....where ever we need we can use.. ....................... So always better to declare globally...
@mohammedsajeed9398
@mohammedsajeed9398 Жыл бұрын
@@chennupatiharika9863 that means we are fixing the global variables as constants, is it right to say?
@santoshkumarkar39
@santoshkumarkar39 2 жыл бұрын
Same as Java
@goutham8751
@goutham8751 4 жыл бұрын
thank u sir u helped me a lot
@pawangoled9622
@pawangoled9622 Жыл бұрын
I mean the output
@city_roczs971
@city_roczs971 4 жыл бұрын
Sir please one more video on functions and nested function
@rumagoswami3272
@rumagoswami3272 5 жыл бұрын
superb
@krishnadesai4538
@krishnadesai4538 4 жыл бұрын
very helpful sir thank you
@harikav3443
@harikav3443 5 жыл бұрын
Sirr CG gurinchi cheyyandi sir.inka konni topics
@sandeepjella3270
@sandeepjella3270 5 жыл бұрын
good
@naidudarapu6891
@naidudarapu6891 4 жыл бұрын
Super
@pallavis8618
@pallavis8618 5 жыл бұрын
If we have to access global variable inside function definition and both global and local variable have same name
@icebear6904
@icebear6904 4 жыл бұрын
I think then we have to specified Global 'variable name' inside a function to use the same name variable. Otherwise function used the local variable for the operation.
@ramzy8814
@ramzy8814 4 жыл бұрын
Just try it yourself and see the result
@AjayJain-ef2mz
@AjayJain-ef2mz 4 жыл бұрын
​@@icebear6904 Can you please send a brief code as it didn't work for me.
@sajayad5182
@sajayad5182 2 жыл бұрын
I not understand sir
@westfield90
@westfield90 5 жыл бұрын
Only part I didn’t understand was the bottom part you said was a main function. Don’t you have to define the main function ?
@manjulabestha3675
@manjulabestha3675 2 жыл бұрын
Thank u sir
@raginim3237
@raginim3237 2 жыл бұрын
Thank u sir
@arunakumari328
@arunakumari328 3 жыл бұрын
Thanks sir
@manjulavg4686
@manjulavg4686 4 жыл бұрын
Thank u sir
TYPES OF ARGUMENTS IN FUNCTIONS - PYTHON PROGRAMMING
20:56
Sundeep Saradhi Kanthety
Рет қаралды 117 М.
local and Global Scope in Python | Python Tutorials for Beginners #lec78
14:34
Jenny's Lectures CS IT
Рет қаралды 35 М.
아이스크림으로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 52 МЛН
KINDNESS ALWAYS COME BACK
00:59
dednahype
Рет қаралды 135 МЛН
THEY WANTED TO TAKE ALL HIS GOODIES 🍫🥤🍟😂
00:17
OKUNJATA
Рет қаралды 21 МЛН
🤔Какой Орган самый длинный ? #shorts
00:42
RECURSION - PYTHON PROGRAMMING
10:00
Sundeep Saradhi Kanthety
Рет қаралды 155 М.
INTRODUCTION TO FUNCTIONS - PYTHON PROGRAMMING
14:45
Sundeep Saradhi Kanthety
Рет қаралды 209 М.
DICTIONARIES (CREATION AND ACCESSING) - PYTHON PROGRAMMING
20:54
Sundeep Saradhi Kanthety
Рет қаралды 75 М.
OOPS CONCEPTS IN TELUGU || OBJECT ORIENTED PROGRAMMING CONCEPTS IN TELUGU
34:28
Sundeep Saradhi Kanthety
Рет қаралды 89 М.
Local vs Global Variables in Python| Python Tutorial - Day #48
10:37
CodeWithHarry
Рет қаралды 156 М.
OOPS CONCEPTS - JAVA PROGRAMMING
20:24
Sundeep Saradhi Kanthety
Рет қаралды 2 МЛН
#32 Python Tutorial for Beginners | Functions in Python
11:13
Telusko
Рет қаралды 1 МЛН
아이스크림으로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 52 МЛН