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

Peter, Bridget and Caroline share some sweets in the ratio 2:5:2. Peter gets 14 sweets. How many did Bridget get?
Select the term for the drink shown in the image. A. el café B. el jugo C. el mate D. el agua
Please Help! ¯\_(ツ)_/¯ Which of the following is the best resource to help you learn about the appearance, habitats, and behaviors of birds in your area? Phot
ABC Company sales last year were 454, 000 , and its yearend total assets were 798000. The average in the industry has a total assets tumover ratio of 7 ABCCompa
Please help me! with this!
Which of the following does Roosevelt advocate in the passage?
European traders traveled the ___ to buy items such as spices from the Chinese. Beijing Silk Road Great Wall of China
Research has found that chimpanzees in one area make spears to help them hunt bushbabies (African lorises). The chimpanzees locate a tree trunk in which the bus
PICTURE INCLUDED!A circle has a center point (4,1 and a point on the circle edge of (9, 1)​
What is the average rate of change of the function y = cos(x) over the interval [0,2]?