Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Multicolored Lamp by ilya.tleukenov
class Lamp():
def __init__(self,states={1:'Green',2:'Red',3:'Blue',0:'Yellow'},trigger=0):
self.states = states
self.trigger = trigger
def light(self):
self.trigger += 1
return self.states[self.trigger%4]
Feb. 28, 2019