Question: Determining Whether to Stop: Your first exercise is to write a function called stop that takes parameters traffic _ light and pedestrian, and returns a
Determining Whether to Stop: Your first exercise is to write a function called stop that takes parameters trafficlight and pedestrian, and returns a boolean value representing whether you should stop or not. There are only two cases where the function should return True:
If trafic light is 'Red'
If there are pedestrian ready to cross the street
Checking Permission to move Foward: Your second exercise is to write a function called movefoward that takes parameters trafficlights and pedestrian, and returns a boolean value representing whether you can move foward True or not False There are olny two ccases where the function shoul return True:
If he traffic light is 'Green' and there are no pedestrians ready to cross the street.
If the traffic light is Yellow' and there are no pedestrians ready to cross the street.
Determine Whether it Can Turn Left: Last exercise is to write a function called tuenleft that takes trafficlights, pedrestrians and caropposites and retuns a boolean value representing wether you can do a left tuen or not. There is only one case wether the function should turn 'True':
If the traffic light is 'Green' and there are No pedestrians and No cars going foward in th eother direction.
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
