# Use () around a comprehension to make a generator expression my_list = [x for x in range(0,10)] my_generator = (x for x in range(0,10)) print(my_list) print(my_generator) # To generate the next item in a generator use next() next(my_generator) # You can iterate through a generator with a for loop: for item_left in my_generator: print(item_left) # Once all items have been generated, the generator is exhausted next(my_generator)
@funnyclips26962 жыл бұрын
U hv such a highly simplified powerful tutorials that I only got to know this week. That's interesting indeed....👍🏾👍🏾
@v4ldevrr4m472 жыл бұрын
Great simple sample using ( list comprehension), I need see the girl video . Thanks again
@KhalilYasser2 жыл бұрын
Amazing youtube channel. Thanks a lot.
@treksis3 жыл бұрын
Thanks. So, it's like sorted(stuff) vs. stuff.sort()?