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
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