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

Select the two statistical questions that Gary could ask, A How old is your school? B How many pets do you have? C What is your favorite flavor of ice cream? D
He was the Supreme Commander of Allied troops in Europe and the executor of the D-Day invasion.
Simplify the following expression. 2 + [(15 + 3) × 2]
in math what are 3 ways numbers are related
What is the radius of a sphere with a volume of 41572 cm', to the nearest tenth of a centimeter?
Joe made 5 loaves of banana bread. If one serving is 1/5 loaf, how many servings does Justine have? T
Three people are sitting on a bus. Belle is seated 4 meters directly behind Diego and 3 meters directly left of Reba. How far is Diego from Reba?
Why did the group of boys swimming in the wild bay reject Jerry and swim away?
Classify each triangle as a right triangle or not a right triangle
how does a supercharger work?