Can someone please make a lamp algorithm as an example? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone please make a lamp algorithm as an example?

The lamp is broken. It is also plugged in and the bulb is not burnt out. If it is not plugged in, then plug it in. Else, If the bulb is burnt out, then replace it. Else, Repair lamp.

6th Apr 2017, 7:20 PM
Scrambles
1 Answer
+ 18
You have 3 booleans there: broken = True pluggedIn = True burntout = False Now you need to implement the if-elif-else
6th Apr 2017, 7:25 PM
Jafca
Jafca - avatar