Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simply itertools.cycle() solution in Clear category for Multicolored Lamp by Mysta
from itertools import cycle
class Lamp:
def __init__(self) -> None:
self.colors = cycle(["Green", "Red", "Blue", "Yellow"])
def light(self) -> str:
return next(self.colors)
April 10, 2026
Comments: