logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Bhargav AppasaniEngineering
(/5)

644 Answers

Hire Me
expert
Dennison BertonBusiness
(5/5)

513 Answers

Hire Me
expert
Robin HunterGeneral article writing
(5/5)

626 Answers

Hire Me
expert
Vishal BhadwajAccounting
(5/5)

587 Answers

Hire Me
Python Programming
(5/5)

you have four light bulbs and three buttons. The 1st button works with the 1st light bulb, the 2nd button works with the 2nd and the 3rd light bulbs,

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Python Puzzle 

In this puzzle, you have four light bulbs and three buttons. The 1st button works with the 1st light bulb, the 2nd button works with the 2nd and the 3rd light bulbs, and the 3rd button works with the 1st and the 4th light bulbs.

Note that a button changes the states of corresponding light bulbs. When you click a button, if a light bulb is on, it will be off, and if a light bulb is off, it will be on. The goal of the puzzle is to turn on all the light bulbs using the buttons.

lightList = [False, False, False, False]

Write a condition of the while-loop statement.

In this part, you need to write a correct condition of the while-loop statement so that the program runs continuously until the goal of the puzzle is achieved. The goal of the puzzle is to turn on all the lights. You need to think about what condition makes the program run until all the lights are on.

When you write the condition, you need to use the given LightList list in the program where a state of each light (on/off) is described using Boolean data type. Each light corresponds to each slot of lightList. For example, if the 1 st light is on, lightList[0] has True, and if the 2 nd light is off, lightList[1] has False. At the beginning of lightPuzzle.py, all the slots of lightList have False ( lightList=[False, False, False, False] ), and it means that all the lights are off initially.

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme