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

5 (10k + 1) + 2 (2 + 8k)
A floor mat of dimensions 459cm and 355 cm was cut into square shaped door mats and it was seen that a piece of 9cm by 5 cm is left. What is the maximum length
The fraction 3/10 is the difference of 8/10 and which fraction
What is the value of x? What is the value of y?
-2 = -x squared + 5
Please this is urgent What is the correct algebraic expression of the following statement? The quotient of two consecutive positive integers with the largest n
Help solving this math
- What did Ender realize after Graff left?
what is the ratio of the rate of effusion of helium (atomic mass 4.00 amu) to that of oxygen gas (molecular mass 32.0 amu)?
what cross section results when you cut a cylinder perpendicular to its base?