Company: Agoda
Difficulty: easy
Generator Context Create a context manager class called sequence_generator that produces an infinite sequence of numbers. The sequence starts at a given value and increases by a fixed step with each iteration. The class must expose a generate method that yields the numbers of the sequence. For example, a sequence that starts at 3 with a step of 5 produces 3 , 8 , 13 , ... and so on forever. with sequence_generator(3, 5) as gen: for _ in range(3): print(next(gen), end=" ") prints 3 8 13 . Function Description Complete the class sequence_generator . The constructor takes int start (the first value) and int step (the amount added at each iteration). generate : in Python it is a generator that yields start , start + step , start + 2 * step , ... without end. In C++ and Java there is no with statement, so generate() returns the next value of the sequence each time it is called (the first call returns start ). Python only: entering the with block ( __enter__ ) must return an iterator over th