Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started