ppe2/src/codewars/kata_the_lamp.py

14 lines
273 B
Python

class Lamp:
def __init__(self, color: str):
self.color = color
self.on = False
def toggle_switch(self):
self.on = not self.on
def state(self):
if self.on:
return "The lamp is on."
return "The lamp is off."