Count the Swaps
Complete bubble_sort_with_count(items) so it sorts the list using bubble sort and returns a tuple (sorted_list, swap_count) - the number of swaps actually performed. This turns 'how much work did the algorithm do' into a real, measurable number instead of just an impression. Input is a comma-separated list of integers.
main.py
Loading editor…
Console
Run your code to see output here.