Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
cycle solution in Clear category for Multicolored Lamp by pherapont
from itertools import cycle
class Lamp:
def __init__(self):
self.colors = cycle(["Green", "Red", "Blue", "Yellow"])
def light(self):
return next(self.colors)
July 12, 2019
Comments: