Mar-27-2020, 11:34 AM
No problem.
Hints:
- iterate over the first dimension, which requires an additional loop on the top
- use the sub element, which is the 2nd dimension, to sort it inline with your algorithm
- key<arr[j][0] is wrong. Remove the [0] and think what this does. Exception:
- you're modifying the original data, which is bad, you could use copy.deepcopy to prevent the change of the original arr
- you should return the sorted 2D-array and not printing them in your function
Hints:
- iterate over the first dimension, which requires an additional loop on the top
- use the sub element, which is the 2nd dimension, to sort it inline with your algorithm
- key<arr[j][0] is wrong. Remove the [0] and think what this does. Exception:
TypeError object is not subscriptable
- you're modifying the original data, which is bad, you could use copy.deepcopy to prevent the change of the original arr
- you should return the sorted 2D-array and not printing them in your function
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!