#62 Python Tutorial for Beginners | Generators

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ก.ย. 2024
  • Github :- github.com/nav...

ความคิดเห็น • 146

  • @thatguyadarsh
    @thatguyadarsh 5 ปีที่แล้ว +51

    videos are getting very much interesting as we go towards the end of the course...thankyou sir !!

  • @AyatTV-82
    @AyatTV-82 4 ปีที่แล้ว +35

    I discovered your channel recently and I've been enjoying your good work. Please keep it up.

  • @saiprasad5856
    @saiprasad5856 5 ปีที่แล้ว +6

    Thank you Naveen Reddy Sir for your series on python..It helped me to learn in an easy manner ...Thank you so much

  • @preethirajput9969
    @preethirajput9969 ปีที่แล้ว

    Daily I watch your videos one by one. you Explain the concept in such a way that we Easily catch you...
    KEEP GOING SIR..

  • @imranshaikh115
    @imranshaikh115 4 ปีที่แล้ว +2

    Awesome sir very nice. I am following python series from the very beginning and will go till the End

  • @meenukidsvlogs3118
    @meenukidsvlogs3118 2 ปีที่แล้ว +2

    Hi Navin sir , Thank you somuch for making each and every concept so simple and understandable .keep up the good work.

  • @MRGolum
    @MRGolum 5 ปีที่แล้ว +13

    We can also creat generator with generator comprehension...
    G = (i for i in range(1,10))

    • @VivekYadav-ds8oz
      @VivekYadav-ds8oz 5 ปีที่แล้ว +7

      But isn't that what we want to avoid? Creating a list/tuple with all the desired records stored in the memory all at once?

    • @c_t9908
      @c_t9908 4 ปีที่แล้ว +2

      @@VivekYadav-ds8oz not when you print(next(G))

  • @054_ritesh3
    @054_ritesh3 3 ปีที่แล้ว +2

    Love your style of explaining things very efficiently 👍👍👍

  • @vikashsharma8109
    @vikashsharma8109 ปีที่แล้ว

    ohh....man..what an confidence of teaching ...ur kind of different comparing others..cool way of teaching

  • @shaikanmol7630
    @shaikanmol7630 3 ปีที่แล้ว +1

    enjoying your videos ..... We got to know much more deep information from your explantaion

  • @rajeevsinghrajput6752
    @rajeevsinghrajput6752 4 ปีที่แล้ว +2

    I am grateful to you sir....
    Very Nice teaching sir...........

  • @sammygichuki8349
    @sammygichuki8349 7 หลายเดือนก่อน

    Hello i really learn alot from your videos i am from Kenya i learn python on my smartphone sololearn and evertime i

  • @arockdurai5110
    @arockdurai5110 11 หลายเดือนก่อน

    Very simple and easy to follow examples. kudos to you.

  • @BIPINKUMAR-wo1ct
    @BIPINKUMAR-wo1ct 2 ปีที่แล้ว

    Very much interesting!! And clear about all concept and doubts.

  • @BandariSrilekhana21b014
    @BandariSrilekhana21b014 หลายเดือนก่อน

    def topten():
    for i in range(1,11):
    yield i*i
    values = topten()
    for i in values:
    print(i)

  • @pulkitmehta1795
    @pulkitmehta1795 5 ปีที่แล้ว +3

    Very well explained . Thanks.

  • @MsAlokranjan
    @MsAlokranjan 5 ปีที่แล้ว +3

    Your teaching technique is awesome 👌👌👌👍👍

  • @yogeerao9149
    @yogeerao9149 2 ปีที่แล้ว +1

    Hey Naveen Coz of You I have learned Python and Django perfectly Thank You So Much :-) Love from Hyderabad 😍

  • @firsttouse6465
    @firsttouse6465 4 ปีที่แล้ว +2

    +++ when use yield the MAIN value of the function will be the one that assigned to yield (sq)
    +++when ask for the function (which main value of it is the one that assigned to yield because of yield effect) will give you the next value of the variable that assigned to yield (sq) and that was the main two features of yield

  • @moizrehman8594
    @moizrehman8594 5 ปีที่แล้ว +3

    print("sir you looks good in mustache and you teaching method() is also very impressive")

  • @chhavimanichoubey9437
    @chhavimanichoubey9437 5 ปีที่แล้ว +3

    def table():
    n = int(input('enter value to find table of it:'))
    itt = 1
    while itt

  • @arpanmathe6865
    @arpanmathe6865 3 ปีที่แล้ว

    Amazing explanation in every video. Very useful to clear the concepts.

  • @srijayanrajendran5247
    @srijayanrajendran5247 2 ปีที่แล้ว

    thanks sir.. your videos are awesome, and it makes us feel like coding is tricky but easy.

  • @viditjain2508
    @viditjain2508 4 ปีที่แล้ว

    You said that Generators do not work in methods but do in functions, which means it can not be made in a class, but, i actually did it and that to in a static method inside of a class.

  • @randhirpatil6443
    @randhirpatil6443 3 ปีที่แล้ว

    sir, I am understood the your lectures ,that is very interesting .Thanks a lot.

  • @kiraninam
    @kiraninam 4 ปีที่แล้ว +1

    the best explanation on the internet. good job

  • @dikshantgupta5539
    @dikshantgupta5539 4 ปีที่แล้ว +6

    why we have to write 15-16 of code just to print 1--10 values. this can be easily done with the help of loops

    • @sourabhsharma9830
      @sourabhsharma9830 ปีที่แล้ว +1

      If you have 100 TBs if data and want to reduce the data, you can use loops because of memory constraints but you can use generators to load chunks of data and reduce it one by one.

  • @satishj27
    @satishj27 3 ปีที่แล้ว

    Easy to understand explanation and example thank you very much bro✌🏻

  • @tusharjoshi7177
    @tusharjoshi7177 5 ปีที่แล้ว +7

    Hi can you make videos of Linux , Jenkins and devops

  • @hritikbhagatofficial
    @hritikbhagatofficial 5 ปีที่แล้ว +1

    sir please make a video on how to make a website using python. we expect that... . many people are already teaching to make a website but no one good for nothing .because they are not reliable we rely on you.

  • @aadhiyanth5969
    @aadhiyanth5969 11 หลายเดือนก่อน

    Thank you, My family is happy now, and that is what i want
    - Thomas Shelby

  • @letsdoeverythinginoneweek9398
    @letsdoeverythinginoneweek9398 4 ปีที่แล้ว

    this course is best ,ultimate best

  • @cyclotrongamer4263
    @cyclotrongamer4263 2 ปีที่แล้ว

    Video and Content quality is Amazing sirG🤩🤩🤩🤩🤩

    • @KeremAli-cm3pj
      @KeremAli-cm3pj 2 หลายเดือนก่อน

      Really? Try epsiode 60.

  • @kashifstudent2791
    @kashifstudent2791 2 ปีที่แล้ว +1

    yield = iterative return is it sir

  • @hxrsh_x
    @hxrsh_x 3 ปีที่แล้ว +1

    Sir, what was the use of all these things if we had to use for loop at the end for printing values ?
    Please anyone EXPLAIN !!!

  • @sammygichuki8349
    @sammygichuki8349 7 หลายเดือนก่อน

    Everytine i visit your videos i realise there so many things left out in sololearn do u offer classes on smart phone

  • @demigod6190
    @demigod6190 4 ปีที่แล้ว +3

    just awesome sir

  • @BalajiChopparapu
    @BalajiChopparapu 3 ปีที่แล้ว +1

    This is awesome explanation. Keep going. It helps python community

  • @vvkwadhwa
    @vvkwadhwa 4 ปีที่แล้ว +1

    As per example the data came at once for all, so how do we differentiate between iterator and generator.

  • @natashasen3548
    @natashasen3548 2 ปีที่แล้ว

    What a great explanation! Thank you so much.

  • @durgaprasadsriramoji5111
    @durgaprasadsriramoji5111 4 ปีที่แล้ว +1

    We normally fetch the records in a cursor then loop thru and process one record at a time rt? Yes, we are fetching 1000 records into memory with the cursor, we can overcome this with Generators is what you mean? little confusion , someone pls clarify

  • @navneetghosh9691
    @navneetghosh9691 5 ปีที่แล้ว +1

    Hi Sir, I have a query regarding the file handling videos, can you please make a separate video on file handling, how to upload the image, song etc. I will be thankful to you if you make so.

  • @narendrababu2076
    @narendrababu2076 2 ปีที่แล้ว +1

    sir u r looking different in this vedio

  • @d4rknesh629
    @d4rknesh629 หลายเดือนก่อน

    useful video 👍

  • @liman12011988
    @liman12011988 5 ปีที่แล้ว +1

    Thank you sir for this informative video, subscribed

  • @indrajitauddy6958
    @indrajitauddy6958 2 ปีที่แล้ว

    Understood... Thanks :)

  • @skrishnan9625
    @skrishnan9625 4 ปีที่แล้ว +1

    I am studying 11th standard. I don't know whether genetators are there in 11th portion. Please reply whether these portions are there for me.

  • @skviknesh
    @skviknesh 2 ปีที่แล้ว

    Clean Explanation!!!

  • @user-ww2lc1yo9c
    @user-ww2lc1yo9c 3 ปีที่แล้ว

    You did not explain how yield works i.e does the function just "stop" in time when it reaches yield and how does for loop know that no more yields are coming?

  • @Aris-lq7xe
    @Aris-lq7xe 9 หลายเดือนก่อน +1

    greast vid
    😃

  • @snehashishpattnaik3824
    @snehashishpattnaik3824 3 ปีที่แล้ว

    great to understand

  • @rahulagarwal7182
    @rahulagarwal7182 3 ปีที่แล้ว

    Great Video

  • @Rahu923
    @Rahu923 5 ปีที่แล้ว +1

    Hii sr pls sr help me sr muje ye nhi
    Pata chl rha he ki me computer programing me ky kru...

  • @vinaykumar-jt7lw
    @vinaykumar-jt7lw หลายเดือนก่อน

    Thank you so much sir

  • @hritikbhagatofficial
    @hritikbhagatofficial 5 ปีที่แล้ว +1

    good job

  • @creativemind4608
    @creativemind4608 4 ปีที่แล้ว

    Excellent explanation.. Thanku..

  • @vivekyadav2566
    @vivekyadav2566 ปีที่แล้ว

    Gr8 💯✨ thnk u

  • @matissjansons8789
    @matissjansons8789 10 หลายเดือนก่อน +4

    not really for beginners bruh

  • @VimalVK-u7n
    @VimalVK-u7n ปีที่แล้ว

    Thanks

  • @sheikhjebran9447
    @sheikhjebran9447 4 ปีที่แล้ว

    Awesome

  • @kundrapuharika6294
    @kundrapuharika6294 ปีที่แล้ว

    Thank you sir

  • @dhairyashah1746
    @dhairyashah1746 4 ปีที่แล้ว

    why can't we use a for loop here instead of while loop? pls explain

  • @sathvikmalgikar2842
    @sathvikmalgikar2842 2 ปีที่แล้ว

    you are superb sir

  • @Matrix_Mayhem
    @Matrix_Mayhem ปีที่แล้ว

    Hi Navin,
    Why a function and not a class?

  • @prabalbhardwaj1829
    @prabalbhardwaj1829 5 ปีที่แล้ว

    Awesome , Thank you Sir

  • @KoreaRwkz
    @KoreaRwkz 4 ปีที่แล้ว +1

    5:10
    So an iterator fetches all items in a sequence first?

  • @balireddyyerabham331
    @balireddyyerabham331 4 ปีที่แล้ว

    SUPER SIR

  • @boooringlearning
    @boooringlearning 3 ปีที่แล้ว

    thanks

  • @RK-ce8mu
    @RK-ce8mu 5 ปีที่แล้ว

    superb

  • @ankitachauhan6780
    @ankitachauhan6780 3 ปีที่แล้ว +1

    Why do we need generator and iterator ,if we can iterate using loops

    • @aghilpwilson879
      @aghilpwilson879 3 ปีที่แล้ว

      It will create memory error if we use large number to iterate...since it will first store the value..generators helps to avoid that error since it will not store the values

    • @jyoshnadeepala4439
      @jyoshnadeepala4439 2 ปีที่แล้ว

      to iterate not just int or any built in types, but iterate our own class ojects

  • @user-kb9tz7pp9y
    @user-kb9tz7pp9y 3 ปีที่แล้ว

    can someone clarify..why is while being executed once at a time??

  • @Natural__1
    @Natural__1 5 ปีที่แล้ว

    Good job

  • @prateekmaurya4187
    @prateekmaurya4187 3 ปีที่แล้ว

    make series on python turtle

  • @dadivenkat4213
    @dadivenkat4213 3 ปีที่แล้ว

    Hi, I have a clarification how the code worked. We just created "values" object. We didn't call any methods, but still how it is printing. Generally we have to call the method (eg:- values.__iter__() or values.__next__()) right?
    Is there anything like the methods declared with dunders(___x__()) will be executed automatically when you create an instance.
    When we gave "print(next(values))" it printed only once, where as in for loop it printed 10 times. So how the variable 'i' knows its iteration value. Can anyone help

    • @ashishpatil79
      @ashishpatil79 ปีที่แล้ว

      when you use yield it will return iterator

  • @vihalrao1870
    @vihalrao1870 4 ปีที่แล้ว

    can we use genrator inside the class ? if yes anyone explain me with example?

  • @rtpictures6858
    @rtpictures6858 2 ปีที่แล้ว

    so what i don't get is that where we can use this

  • @DragonRazor9283
    @DragonRazor9283 3 ปีที่แล้ว

    Thanks!

  • @tanishlahoti5277
    @tanishlahoti5277 3 ปีที่แล้ว

    sir the same thing be done without yield

  • @simarjitkaur2864
    @simarjitkaur2864 4 ปีที่แล้ว

    you are amazinggggggggggggggggggggggggggggg

  • @madhavisasanka9433
    @madhavisasanka9433 3 ปีที่แล้ว

    if we can use for loop then what is the need of next(). can you please clarify

    • @vojtechbrecka201
      @vojtechbrecka201 3 ปีที่แล้ว +4

      Hey! For loops are very cool, but you are a bit limited. With the method next() you can use the first element of your list for something, than write some lines of codes and than use the next element of your list (tuple, string...) for something different.
      Thi is something that cannot be done with for loop. For loop is great but only when you want to do the exact same thing with every single element of your list.
      I hope you can understand, sorry for my english, it is not my native language and good luck with programming!

  • @madhuyagadasu5963
    @madhuyagadasu5963 2 ปีที่แล้ว

    Why do we use iterators and generators in real life?

  • @ROHIT-gv7xk
    @ROHIT-gv7xk 5 ปีที่แล้ว

    great

  • @SIISKSARAVINDAKASHYAP
    @SIISKSARAVINDAKASHYAP 4 ปีที่แล้ว

    I didn't get the difference between this iterator and generator.. Can anyone help me out with this!!!!

  • @sheikwaris
    @sheikwaris 4 ปีที่แล้ว

    if i replace yield using return then the code is failing - 'int' object is not iterable - pls stat whats issue here

    • @manideepthatikonda4199
      @manideepthatikonda4199 3 ปีที่แล้ว

      values will become Integer not generator class.. For Loop should be used with iterators
      So when you use return , In for loop you should you use range(values)

  • @computertech1640
    @computertech1640 5 ปีที่แล้ว

    Good

  • @prasadmanedeshmukh5905
    @prasadmanedeshmukh5905 3 ปีที่แล้ว

    fantastic concept!!!

  • @ck3908
    @ck3908 5 ปีที่แล้ว

    Thank u Sir!

  • @saitanush9453
    @saitanush9453 3 ปีที่แล้ว

    tq

  • @shahporanhimel9207
    @shahporanhimel9207 3 ปีที่แล้ว

    class twenty():
    n=1
    while n

    • @CSREVATHIV
      @CSREVATHIV ปีที่แล้ว

      No because of you do not using class using def()

  • @artisticw1zard
    @artisticw1zard 5 ปีที่แล้ว +1

    ha ha. i knew it. iterator --> generator

  • @aritrodas2264
    @aritrodas2264 4 ปีที่แล้ว

    Can we write this statement instead of the while loop?
    for i in range (1,11):
    sq=i*i
    yield sq

    • @RANDOMSTUFF-my3yd
      @RANDOMSTUFF-my3yd 4 ปีที่แล้ว +1

      Yes
      but it will only work when you know there are 10 numbers only
      but when you have to get values from user then your code will not come in use. ✌

    • @kavnainvohra8228
      @kavnainvohra8228 3 ปีที่แล้ว

      @@RANDOMSTUFF-my3yd Yeah, But if we set the user input in the for loop itself, the code will still work, either way if you want to use for loop or while loop, your choice!

  • @freemanfreed1581
    @freemanfreed1581 3 ปีที่แล้ว

    so for loops are iterator implementations ???

  • @nithinmamidala
    @nithinmamidala 5 ปีที่แล้ว +1

    hi..is it really necessary to have a knowledge on full python for data science..

    • @sivaprakash2247
      @sivaprakash2247 5 ปีที่แล้ว

      Yes bro u have to not the entire part but we need to implement oru analysticals through such and i too learning it for da:-)

  • @mad8ry
    @mad8ry 4 ปีที่แล้ว

    Eeeeeld = yield ?!
    which means
    Eellow = yellow

  • @anandmm1712
    @anandmm1712 3 ปีที่แล้ว

    Sir O/p may be 1,2,1,2,3,4 right

    • @anandmm1712
      @anandmm1712 3 ปีที่แล้ว

      Because __next__ method wil preserve old values ... You told sir

  • @nakshatranahar
    @nakshatranahar 5 ปีที่แล้ว

    dammmm nice

  • @domoreofficial
    @domoreofficial 4 ปีที่แล้ว

    informational video, but the music at the start and end irritates. overall it's a nice video... thanks

  • @madhursharma8217
    @madhursharma8217 4 ปีที่แล้ว

    Why not class?

  • @venkateswarluguntaka7370
    @venkateswarluguntaka7370 4 ปีที่แล้ว

  • @uttamkumardas1629
    @uttamkumardas1629 2 ปีที่แล้ว

    its very tough to understand your way of explaining.