Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Lamp.colors[self.state] solution in Clear category for Multicolored Lamp by Sioul
class Lamp:
colors = ('Green', 'Red', 'Blue', 'Yellow')
def __init__(self):
self.state = -1
def light(self):
self.state = (self.state + 1) % 4
return Lamp.colors[self.state]
Nov. 14, 2019