Question: Task 2 . Implement your function to calculate the number of breakpoints count _ breakpoints ( data ) function implementation This should return the number

Task 2.Implement your function to calculate the number of breakpoints
count_breakpoints(data) function implementation
This should return the number of "breakpoints", which are defined as numbers that are neighbors to each other but with values that are 2 or more away from each other. For example, a call to
count_breakpoints([0,5,4,2,3,1,6,7])
should return 4 because of the breakpoint between 0 and 5, between 4 and 2, between 3 and 1, and between 1 and 6.
Note: if no breakpoints are found, return 0
def count_breakpoints(data): """Return the current number of breakpoints for the given sequence."""

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 Programming Questions!