Scope, Global Variables and Global Keyword | Python Tutorials For Absolute Beginners In Hindi #33

Поделиться
HTML-код
  • Опубликовано: 8 янв 2025

Комментарии • 686

  • @thestrugglingguy6525
    @thestrugglingguy6525 4 года назад +119

    dear harry sir,
    10:57
    Quiz-: that will print 88 because the global keyword will go outer side of the nested functions and read for any variable 'x', and it will be successful also, so that will change the value of x(89) to x(88).
    Thanks for this great content.

  • @wiseexplorer1618
    @wiseexplorer1618 3 года назад +85

    explaining the scope as govt ka paisa and apna paisa is a very good example👍🏻👍🏻

    • @gautambh375
      @gautambh375 3 года назад +1

      bhaii 8:14 me global ke baad x accept ho raha h tera mera nhi ho paya kya galti hogi kuch pata h

    • @nolimits0620
      @nolimits0620 3 года назад +1

      @@gautambh375 aap apna code bhejo

  • @mahaminmondal6248
    @mahaminmondal6248 6 лет назад +64

    I'm a mechanical engineer but I always wanted to learn programming. Thanks to you that you have created a channel and started to teach us programming.. Don't stop teaching.. You're a great teacher. Loved your lessons.. Keep it up!!

    • @mukeshkacha9201
      @mukeshkacha9201 5 лет назад +3

      same here bro.......i am mechanical engineer but always wanted to learn programming .. like this...good channel for python learning......in this tutorials harry always try to explain with which problems beginner will face......

    • @patelayushmukesh2924
      @patelayushmukesh2924 4 года назад

      Same here, I am also a mechanical student I love to learn python programming.

    • @robosapien1413
      @robosapien1413 3 года назад +1

      same here bro .......ithink we should make a group of mechanical engineers ..........please join in telegram @mechnorobes

    • @rajeevmishraa
      @rajeevmishraa 2 года назад

      Same here I am a gig worker

    • @marufahamedsagor5525
      @marufahamedsagor5525 2 года назад

      Same

  • @Press-vh1ix
    @Press-vh1ix 6 месяцев назад +1

    one of the finest yt channels for learning python

  • @utsabbashyal7929
    @utsabbashyal7929 5 лет назад +28

    lots of love from Nepal sir thank you

  • @avadhutkulkarni4534
    @avadhutkulkarni4534 2 года назад +3

    11:03
    It will print 88 because above the code x = 88 we have written global x which will change the value of the x that is written outside the function the value was 89 but by the global function it will make it 88 and hence it will print 88

  • @AbdulSalam-pv6es
    @AbdulSalam-pv6es 2 года назад +2

    11:02
    It will print 88 because in the rohan function you used global keyword which go out of the function and search for the global variable x and after finding it will change its value to 88 and print the value.

  • @sanjaymajumder2991
    @sanjaymajumder2991 3 года назад

    11:15
    Output:
    after calling rohan() 20
    88

  • @GunjanPandya-s8w
    @GunjanPandya-s8w Месяц назад

    11:03
    print 88 bcz global keyword will go outside and read any variable x and it will change 89 to 88

  • @zeeskhan5661
    @zeeskhan5661 2 года назад

    I just get the conception of global keyword only watching one time great work harry bhaiya

  • @adityaskarnam266
    @adityaskarnam266 3 года назад +2

    10:57
    The answer will be 88,
    because of the use of global keyword in the function, the value of x changed completely

  • @abhishek-hb1vg
    @abhishek-hb1vg 5 лет назад +3

    Bhai may nay literally tail bachata.
    You are just awesome. Your teaching techniques sense of humor really awesome. Keep up the good work. Bhai ek interview tips ya fir resume/linkedin profile builder jesa koi video bana do plz.
    Keep up the good work.

  • @abhaytiwari2175
    @abhaytiwari2175 3 года назад +1

    I was too confused about Global Keyword but you cleared my doubts
    Thank you CodewithHarrybhai

  • @flamboyantperson5936
    @flamboyantperson5936 6 лет назад

    bhai aap ho kya??? itna easily concept samjha dete ho jaise maza chal raha hain... Tussi great ho harry bhai. Thank you very much. Subha subha harry bhai ki class ho toh padhne me maza he aajata hain :-) :-)

  • @snehapatil9813
    @snehapatil9813 4 года назад +10

    I would like to thank you for the efforts you have made. I am hoping the same best work from you in the future as well. Please make videos on Machine Learning, AI, Data science.

  • @dhavalparekh1606
    @dhavalparekh1606 2 года назад

    As mechanical engineer coding is easy i have never expected. Thank you so much...

  • @prempratapsingh7323
    @prempratapsingh7323 3 года назад

    Thankyou harry bhai 1 week ho gya hai start kre & literally you r osm
    the way you teach like a friend # sab samaj aata hai or acche se

  • @yashgandhi4675
    @yashgandhi4675 5 лет назад +5

    Awesome videos bhai ... apke efforts se sab log acha sikh rhe hai including me ... keep going harry bhai

  • @kingof70080
    @kingof70080 2 года назад +1

    Best channel of hindi coding😇

  • @Sunshine9p
    @Sunshine9p 3 года назад +5

    10:58 : Harry bhai I think the print(x) will print 88 cuz when you call harry() rohan() is also executed. So it will change the value of global x as 88. Thus the print() function will return 88

  • @unmindedcoder8638
    @unmindedcoder8638 3 года назад +2

    first, it will print x as 20 because the first time x is printed under harry() function and harry() function has its own value of x
    and then it will print x as 88 because when the harry() function called rohan() function also called andit changed the value of x from 89 to 88 with the help of global variable

  • @noobcoder_5114
    @noobcoder_5114 4 года назад +1

    thankyou harry bhai aap hamare liye bahut mehenat karto ho

  • @sgteknicl4589
    @sgteknicl4589 3 года назад +1

    11:13 bro uska answer hai ki vaha par 88 print hoga because jab vo fungtion pehle call kiya tha to vaha par global scope me variable nahi tha par jab aapne x = 89 bana diya to fungtion me usko pehle se hi global variable change karn eki permission thi to usne global x ko 88 bana diya to fir 88 hi print hoga.

  • @aratisingh9631
    @aratisingh9631 3 года назад

    answer to the quiz of the day is
    88 because global keyword will go in outer side of program and search for any variable x and then search will become successful and it will change value of x from 89 to 88
    thanks bro for this amazing content

  • @abhinowyt8564
    @abhinowyt8564 4 года назад +13

    00:01 "harry bhai bahut achhe hain " output XD :-)

  • @I_m_Samar
    @I_m_Samar 4 года назад

    harry bhai, answer is 88 because we have assigned x as a global variable and also get the right to change it by typing global x so it we will give the changed number not the globally assigned number.Thank you all because of you i am here answering your quiz question because you teached me.

  • @AdityaRaj-rj6fv
    @AdityaRaj-rj6fv 2 года назад

    my ode is working after watching this video. Thank you

  • @nc8002
    @nc8002 3 года назад +1

    thank you so much for the nested example. i was searching about it all over the internet but could only find it here. tysm!!!!!

  • @akashisgreat_
    @akashisgreat_ 3 года назад

    Useful Video, my problem Solved after see this video.......

  • @gyaneshsatyawali2206
    @gyaneshsatyawali2206 2 года назад

    It will print 88 but if we call the function harry() after the print statement it will print 89 because first it searchs globally but sees that the user has called a function and then prints the x value in the function.
    Thank you for such quality content.

  • @anmolsinghal484
    @anmolsinghal484 4 года назад

    The way you explained, the govt. explanation.. was quite awesome.

  • @SdnopReal
    @SdnopReal 4 года назад +2

    10:57
    it will print 88 because you have changed the value of 88

  • @deependrakumarrout4172
    @deependrakumarrout4172 5 лет назад

    Me 10 bar dekha bhai or pura clear thanks Harry bhai

  • @sankalpjha2836
    @sankalpjha2836 3 года назад

    just wanted to say thank you harry sir♥ because of you only mene cpp, java, or python sikhi or exams me bhi accha perform kia, thanks a lot

  • @devilgaming5543
    @devilgaming5543 3 года назад

    I learned scripting and hacking tool making with this course

  • @ce13_piyushprajapati40
    @ce13_piyushprajapati40 3 года назад +1

    first one go to harry function in which x = 20 assigned to the x and in the harry function go to rohan function after out from the rohan function and our global variable x = 88 the print statment print the x = 20 because x = 20 is already in harry function so not preference for the global x = 88. and last print x = 88.

  • @arifanwer8189
    @arifanwer8189 6 лет назад

    Maine galat guess kiya tha first time 89 but fir se video dekha tab smj aaya then 88 ,great bhai jaan apki video tutorial mai daily follow kr raha hu ...

  • @nolimits0620
    @nolimits0620 3 года назад +1

    while True:
    print("Thankyou Harry Bhai")
    never going to break the loop👍👍👍

    • @phames2101
      @phames2101 3 года назад +1

      Edit :
      while (True):
      print("Thankyou Harry Bhai"

  • @konozbinrashid7774
    @konozbinrashid7774 Год назад

    Hamesha ki tarhan zabardast Harry bhai!

  • @ManpreetKaur-gy3kl
    @ManpreetKaur-gy3kl 3 года назад

    now i got the solution of the problem. thanks,

  • @urgebharadwaj9081
    @urgebharadwaj9081 3 года назад

    The way you explain is exceptional !!! Thankyou bhaiya❤️.. aapka python full course in hindi wala video dekh ke maine bht kuch sikha... Thankyou once again!!❤️😊🙏

  • @vinsmalya
    @vinsmalya 2 года назад +1

    10:44
    Value of x will be 88

  • @devdesai8562
    @devdesai8562 3 года назад

    you are definetly better than mosh
    great

  • @shloksahuit1038
    @shloksahuit1038 3 года назад +7

    moment when he says "Bajao tali" was op...........

  • @mirzaebrahimbaig5633
    @mirzaebrahimbaig5633 5 лет назад +5

    Behtreen sir love from Pakistan

  • @nitishwadpally9700
    @nitishwadpally9700 4 года назад

    x=88 will be printed
    (kyuki wo def ke bahar x ko dhundega and change karega ji last me hai)
    you get the point.

  • @amantiwari8316
    @amantiwari8316 4 года назад

    Literally this video is very helpful for me... you don't believe I've watched this video many times whenever I forgot this topic, and even I've refer this video to many of my friends who often encounter same problem. Really it's amazing and concept clearing video sir....thanks😘😘

  • @codewithrohit2927
    @codewithrohit2927 2 года назад

    10:57
    Answer of the quiz 88
    because global x=89 and we changed it in our def function into 88
    so our answer is 88

  • @rajivgarg6559
    @rajivgarg6559 2 года назад

    quiz answer is 88 because
    firstly, it will take 89 as global var,
    then, it will call harry(),
    then,local value of x will be 20,
    then,it will call rohan(),
    the global value of x would be 88 now and
    print statement within the function will print 20
    print statement outside the function will print 88

  • @sajidakhan2962
    @sajidakhan2962 4 года назад +2

    U are a superb teacher ❤❤❤
    God bless u.. u are helping so many people by providing this course..thnku..this lec was really interesting and i understood whtever u taught in this video..thnku so mucch for such videos

  • @SimranCE-
    @SimranCE- 3 года назад +1

    Very remindable example to understand this code 🎉

  • @themeditation7994
    @themeditation7994 3 года назад

    I am also from Nepal
    So,helpful video for python

  • @aakarshag1445
    @aakarshag1445 4 года назад

    11:01 it will print 88 because you have used global x = 88 function

  • @sunandasarkar7424
    @sunandasarkar7424 3 года назад +1

    X will print 88 because we change the value of x by the global keyword

  • @rudramondal7993
    @rudramondal7993 4 года назад

    harry bhai me to apke video 2 3 bar dekta hu . thankyou fot yhe video. waiting for your new pytyhon tutorial series

    • @rudramondal7993
      @rudramondal7993 4 года назад

      harry bhai ap thora batana please "before calling rohan" kyu 20 ho raha hae, wo to alag funcation me hae .y 20 is printed?

  • @vishalmankar4969
    @vishalmankar4969 2 года назад +1

    This course is helpful

  • @vlog-extreme
    @vlog-extreme 4 года назад +1

    88 will be printed since we used global keyword in rohan function as it overrites the previous value of x

  • @techkushgaming2825
    @techkushgaming2825 3 года назад +1

    You are wrong at 9:55 sir the before Rohan() line you have to add one more tab so it goes to Rohan()

  • @vikashdas1852
    @vikashdas1852 3 года назад

    Zabarsast smjhate ho bhai. Thank You.

  • @rishabhsharma329
    @rishabhsharma329 4 года назад +3

    This is fantastic. Thank you so much !

  • @gadget4274
    @gadget4274 3 года назад

    x = 88
    def shivansh():
    x = 20
    def sujal():
    global x
    x = 88
    # print("befor calling sujal ()" , x)
    sujal()
    print("after calling sujal ()", x)
    shivansh()
    print(x)

  • @creaturetrendy
    @creaturetrendy 3 года назад

    7:28 Harry Bhai be like: mza aa gya toh bajao taali 😂😂

  • @avaniavijit7327
    @avaniavijit7327 4 года назад +1

    sir 88 output aayega because before the nested function value of x was 89 but in function rohan()
    We called global x and then we assigned the value of x to 88
    So when we print x then we'd will get 88 as the output

  • @dollcyjain2452
    @dollcyjain2452 2 года назад

    10:55
    Quiz answer:
    This will print 88 not 89 because we changed the value of global x

  • @samuelfrank9947
    @samuelfrank9947 3 года назад

    Thank You sir.....as the global keyword will change the value in global so the answer will be 88

  • @dnyaneshwarigund9616
    @dnyaneshwarigund9616 2 года назад

    The Output will be 88 because above the code x = 88 we have written global x which will change the value of the x that is written outside the function the value was 89 but by the global function it will make it 88 and hence the output will be 88

  • @vaibhavvaish7046
    @vaibhavvaish7046 4 года назад

    I love ur way of teaching

  • @beingoutofthebox8906
    @beingoutofthebox8906 3 года назад

    Sarkar ka paisa example was the best example
    Thank u Harry bhaiya

  • @chiragrajvaniya2362
    @chiragrajvaniya2362 2 года назад

    given like 👍to this video
    bcoz of explaination
    (global means GOVERNMENT,
    local means KHUD KA)
    ek like toh banta hai

  • @bikrambhandari5805
    @bikrambhandari5805 Год назад

    10:58
    X = 88
    Because ham ne niche
    globle x
    X = 88
    Kar ke globle variable ko change kiya hai

  • @tejas1674
    @tejas1674 3 года назад

    10:56 print(x) will show answer 88

  • @netuse4956
    @netuse4956 4 года назад

    excellent explanation,i found my answer ... thank you sir

  • @harishrawat941
    @harishrawat941 2 года назад

    88 cause gobal variable (x) value changed by rohan() function
    #learningPythonwithharry #codewithharry

  • @surajmahendraramraj3870
    @surajmahendraramraj3870 4 года назад

    sir from inside that is from harry's function we will get x =20 as printed outcome as there was no change in the local variable and when from the rohan's function which changes the external predefined global variable(89) to 88
    that is why we get output has:
    after calling rohan() 20
    88

  • @ADITYACHATURVEDI-1xp
    @ADITYACHATURVEDI-1xp 3 месяца назад

    quiz- answer is 88 because global variable which we create x change the outer global variable x(89) to x(88).

  • @rachnatiwari7701
    @rachnatiwari7701 2 года назад

    We use global for interchanging local variable . Hence answer is 88.

  • @mohammadshahzil6656
    @mohammadshahzil6656 4 года назад

    ALL THANKS TO HARRRY BHAAAAAI!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1

  • @faizanalso
    @faizanalso 2 года назад

    hello harry i like your video
    i also learn html css js and now py

  • @olive_adi
    @olive_adi 4 года назад

    Thanks for helping us to learn python and many more..

  • @gamingmonster7163
    @gamingmonster7163 3 года назад

    Sir, it will print 88 because in the global variable it is 88 and when it will go up out of the nested function it will find the variable X it's value is 89 so it will change the value to 88

  • @amriteshnandan5763
    @amriteshnandan5763 3 года назад

    it will print 88 because global variable is defined before..
    so **global x** will find x and then change it to 88

  • @Shubhams_Globe_Trek
    @Shubhams_Globe_Trek 3 года назад

    first i complete C, C++ of harry sir thats why phython is much more easy to me

  • @Aamiruk65
    @Aamiruk65 2 года назад

    Thanks for the brilliant lecture

  • @viveksingh7157
    @viveksingh7157 4 года назад

    l = 10
    def function1(n):
    # l = 5
    m = 8
    # global l
    k = l + 20
    print(k, m)
    print(n, "What I have Printed")
    function1("This is ")
    print(l)

  • @AbhayKumar-oz4oh
    @AbhayKumar-oz4oh 5 лет назад

    bajao taali , hahahahahaha
    so nice video Harry bhai

  • @surekhadeore9283
    @surekhadeore9283 4 года назад +1

    Quiz-6 Answer
    Yes 88 will be printed

  • @ramkharche6914
    @ramkharche6914 3 года назад +1

    88 hoga op kyuki rohan wale function me humne use phirse assign karke change kiya "global x" use karke.

  • @saharayub4448
    @saharayub4448 2 года назад

    best explanation! thnx dude!

  • @ashishpal4354
    @ashishpal4354 10 месяцев назад

    x=89
    def mintu():
    x=20
    def Ashish():
    global x
    x=88
    # print("before calling Ashish()",x)
    Ashish()
    print("after calling Ashish ()",x)
    mintu()
    print(x)
    output is 88

  • @codinglover1477
    @codinglover1477 3 года назад

    11:05
    The value of x will be 88

  • @sewp032
    @sewp032 3 года назад +1

    quiz
    itll print 88 because we changed its global value in second function

  • @gautambh375
    @gautambh375 3 года назад +1

    sir 8:14 me globL ke baad x nhi accept kr raha plz bataye kya problem hui h

  • @nitinpatil-gf7jt
    @nitinpatil-gf7jt 5 лет назад

    Harry. You are awesome man...

  • @angelikathomas3226
    @angelikathomas3226 3 года назад +4

    Please make videos on Machine Learning, AI, Data science and i would love to learn more about the Jarvis programme other than the one you made.

  • @adityapaluskar
    @adityapaluskar 4 года назад

    Sir the output for the
    harry() will be 88
    because as you mentioned
    the global keyword will directly
    search for the x out of the
    def harry()
    and the x = 89
    will be changed to x = 88
    and the output for it definitely
    will be x = 88

  • @nagasatish8994
    @nagasatish8994 4 года назад +1

    I have an example for better understanding.
    Let
    I am living in my house in apartments.
    Akshay Kumar is my family member and his is age 20.
    Print(Akshay kumar age)
    20
    Global ( Bollywood ) Akshay Kumar
    Print(Akshay kumar age)
    52
    If we don't have Akshay kumar in my family but in my apartments.
    print (Akshay kumar age) it won't check in apartments(Nested function) for Akshay whether he exist or not. It print global (Bollywood) Akshay kumar age.
    52

  • @vaibhavvishwakarma9635
    @vaibhavvishwakarma9635 3 года назад

    Output for harry() = 20, 88
    Output of x = 89

  • @muddasirkhan6838
    @muddasirkhan6838 3 года назад

    harry bhai u r the great

  • @Amit-cg9le
    @Amit-cg9le 5 лет назад +2

    Output :
    after calling rohan() 20
    88

  • @pretecheducation1403
    @pretecheducation1403 4 года назад

    It will print same 88 because the global value given in function it will change the earlier given