Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Itertools.cycle + next solution in Clear category for Multicolored Lamp by swagg010164
from itertools import cycle
class Lamp:
def __init__(self):
self.state = cycle(['Green', 'Red', 'Blue', 'Yellow'])
def light(self):
return next(self.state)
Dec. 8, 2019
Comments: