In keeping with the light switch example, the state of the switch can be stored with a Boolean value of True or False. On = True Off = False 12345678910111213 #Light is currently off current = False if current: current = False print('Turning light off') if not current: current = True Reset Turning light on
Are you trying to understand if statement or this entire block of code? Because the block of code kindo of makes no sense?