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 traffic_light 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:
1.If trafic light is 'Red'
2. If there are pedestrian ready to cross the street
Checking Permission to move Foward: Your second exercise is to write a function called move_foward that takes parameters traffic_lights 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:
1. If he traffic light is 'Green' and there are no pedestrians ready to cross the street.
2. 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 tuen_left that takes traffic_lights, pedrestrians and car_opposites 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':
1. 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!