Anonymous9865 Anonymous9865
  • 02-09-2020
  • Computers and Technology
contestada

Write a program to output the signal status based on the signal colour taken as input.
SIGNAL COLOR SIGNAL STATUS
RED STOP
YELLOW WAIT
GREEN GO

Respuesta :

tonb
tonb tonb
  • 02-09-2020

Answer:

colour = "YELLOW"

signalMap = {  

 "RED" : "STOP",

 "YELLOW" : "WAIT",  

 "GREEN" : "GO"

}

print(colour + " means " + signalMap[colour])

Explanation:

Since python doesn't have switch statements, this map is a useful alternative.

Answer Link
ssheikha911
ssheikha911 ssheikha911
  • 02-09-2020
What subject is this
Answer Link

Otras preguntas

The 4 different types of microorgansisms?
The picture explains it.
In 'The School Day Should Start Later," which of the following provides text evidence that best supports the inference that sleep deprivation is more than an oc
What is the main idea of "John's Bright Idea"?Heads up this was written over 100 years ago!
Evaluate the expression when c=-6. c2 +6c+5
Is the number 3,600−−−−−√ rational or irrational?
What does Galileo find that the candelabra in the Cathedral, acting like a pendulum, does?
The beast, a roller coaster in Cincinnati, Ohio, is 1.4 miles long. How far would you travel in 5 rides?
What would an equal society be like ? And why will it be relevant ?
11. How many beats are in each measure? A. 1, B. 2, C. 3, D. 4