Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
cycle(Lamp.sequence) solution in Clear category for Multicolored Lamp by flpo
from itertools import cycle
class Lamp:
sequence = ('Green', 'Red', 'Blue', 'Yellow')
def __init__(self):
self.lights = cycle(Lamp.sequence)
def light(self):
return next(self.lights)
June 11, 2018
Comments: