Closed EricRa closed 4 months ago
The functions sort the list in place, no copy is made, so there's no need to return it.
Just like a.sort()
& random.shuffle(a)
.
And the example code never uses return value of bubble_sort()
, so it's fine.
Thank you for the report! I agree with @KirkSuD about why this is fine.
I'm not sure if this was intentionally omitted for brevity or not, but the bubble sort functions in Item 6 do not include a return statement needed for the code to function as written.
For example, the bubble_sort function demonstrating swapping of variable values should include a "return a" at the bottom of the function.