Question: The groups _ of _ 3 ( ) function takes a list of values and an integer value denoting a threshold. This function will group
The groupsof function takes a list of values and an integer value denoting a threshold. This
function will group the elements of the input list into groups depending on the threshold.
Example: If the threshold is three then, the list will be chopped into sublists each of length ie each
sublist will contain elements. ie the first three consecutive values form a group; the second three
form a group, etc. This function must return a list of lists where each sublist excluding perhaps, the
last is a group containing number of elements equal to the threshold. If there are not enough values to
fill the last grouping, then it will contain fewer than the threshold value.
As examples, consider the following.
groupsof
Write TWO UNIT TEST for your function.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
