diff --git a/week8/akinola/consecutive.md b/week8/akinola/consecutive.md new file mode 100644 index 0000000..af84706 --- /dev/null +++ b/week8/akinola/consecutive.md @@ -0,0 +1,2 @@ +Consecutive +Have the function Consecutive(arr) take the array of integers stored in arr and return the minimum number of integers needed to make the contents of arr consecutive from the lowest number to the highest number. For example: If arr contains [4, 8, 6] then the output should be 2 because two numbers need to be added to the array (5 and 7) to make it a consecutive array of numbers from 4 to 8. Negative numbers may be entered as parameters and no array will have less than 2 elements. \ No newline at end of file diff --git a/week8/akinola/consecutive.py b/week8/akinola/consecutive.py new file mode 100644 index 0000000..1e1acd4 --- /dev/null +++ b/week8/akinola/consecutive.py @@ -0,0 +1,8 @@ +def Consecutive(arr): + l = range(min(arr),max(arr)+1) + + # code goes here + return len(l)-len(arr) + +# keep this function call here +print Consecutive(raw_input()) \ No newline at end of file