Question: Python3 (2) Safe Lead? Implement the safe lead algorithm, designed by sportswriter Bill James, which is designed to answer the question. Under what conditions can

Python3

(2) Safe Lead?

Implement the "safe lead" algorithm, designed by sportswriter Bill James, which is designed to answer the question. Under what conditions can you safely determine that a lead in a basketball game is insurmountable?

The algorithm is as follows:

Take the number of points one team is ahead Subtract three Add 0.5 point if team that is ahead has the ball, subtract 0.5 point otherwise Square the result If the result is greater than the number of seconds left, the lead is safe

Write a function, is_safelead, that has three parameters: lead, the number of points by which one team is ahead; ball, True if the team that is ahead has the ball and False otherwise; and time, the number of seconds left in the game. The function should return True if the lead is "safe", according to the above algorithm, and return False otherwise.

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!