Python Programming - Generators - Discussion

Discussion Forum : Generators - General Questions (Q.No. 12)
12.
What is the purpose of the itertools.count() function when used with generators?
It creates an infinite sequence of numbers
It counts the number of elements in a generator
It initializes the generator function
It generates random numbers
Answer: Option
Explanation:
itertools.count() generates an infinite sequence of numbers, starting from a specified value. When used with generators, it can create an infinite sequence of numbers for iteration.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.