Answered step by step
Verified Expert Solution
Link Copied!

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:
(5)
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 0.
-"Please WAIT, till the light is Green "if the value retumed by light O is I
-"GO! Thank you for being patient" if the value returned by lighto is 2.
ii. A user defined function light that accepts a string as input and returns 0 when the input is RED, 1 when the input is YELLOW and 2 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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

WHAT IS HRM?

Answered: 1 week ago

Question

(a+2)=81 then a=?

Answered: 1 week ago

Question

GENERAL MANAGEMENT IN BUSINESS?

Answered: 1 week ago