coderz.py

Keep Coding Keep Cheering!

Generators in Python

Generator Function: In Python, a generator is a function that allows you to create an iterator, an object that generates a sequence of values. A generator function is defined using the keyword yield, rather than return. When a generator function is called, it returns a generator object, which can be used to iterate over the […]

January 17, 2023 | python | No comments

Iterable and Iterator in Python

What is an Iterable? In Python, an iterable is an object that can be looped over, such as a list, tuple, or string. An iterator is an object that represents a stream of data, and it can be used to traverse through all the elements of an iterable. The built-in function iter() can be used […]

January 12, 2023 | python | No comments

Advertisement