Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple solution in Clear category for Multicolored Lamp by cheikhnamouna
lamps = ["Green", "Red", "Blue", "Yellow"]
class Lamp:
curr_idx = 0
def light(self):
color = lamps[self.curr_idx]
self.curr_idx = (self.curr_idx + 1) % len(lamps)
return color
Jan. 2, 2019