Question: ( a ) Write a python program that simulates a traffic light. The program should consist of the following: ( 5 ) i . A
a Write a python program that simulates a traffic light. The program should consist of the following:
i A user defined function trafficLight that accepts input from the user, displays an error message if the user enters anything other than RED, YELLOW, and GRFEN. Function light is called and following is displayed depending upon return value from light
"STOP, your life is precious" if the value returned by light is
"Please WAIT, till the light is Green if the value retumed by light is I
GO Thank you for being patient" if the value returned by lighto is
ii A user defined function light that accepts a string as input and returns when the input is RED, when the input is YELLOW and when the input is GRFEN. The input should be passed as an argument.
iii. Display SPEED THRII LS BUT KIL LS after the function trafficl ight is executed.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
