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

When weight training, how many repetitions of lifts should you perform in a set to be most effective? A.) 6-8 B.) 8-12 C.) 11-15 D.) 16-20
True or False: people with Dissociative Identity Disorder rarely have more than 10 alter personalities - unlike in the film "Split", where the person has over 2
What are effects of volcanoes emitting ash and gases into the atmosphere? Select all correct answers. changing wind direction increasing acid rain cooler temper
Which equation represents the equation of the line passing through the point a parallel to the given line
Which of the following examples has a unit rate of 45 miles per hour? Select all that apply. A) 135 miles in 3 hours B) 145 miles in 5 hours C) 495 miles in 11
can someone help me with this question
How many grams of aluminum are required to produce 3. 5 moles al2o3 in the presence of excess o2?.
Evaluate how a change in consumer incomes will affect the demand
Grey wants to evaluate the outcome for all stakeholders to inform his decision making. Grey first should consider:.
C•C (c=4) evaluating expressions