Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Enum + cycle solution in Creative category for Multicolored Lamp by swagg010164
from itertools import cycle
from enum import Enum
class Color(Enum):
Green = 1
Red = 2
Blue = 3
Yellow = 4
class Lamp:
def __init__(self):
self.state = cycle([c for c in Color])
def light(self):
return next(self.state).name
Oct. 23, 2020
Comments: