14/15 not understand line 8 and past



Line 8 sets up the outputlist so it contains the first value of inputlist. I will explain why later.

Line 12 goes through the numbers of inputlist and returns the current number to i.

Line 13 tests to check if the current number in inputlist is greater than the last number in outputlist. The reason you needed to add the first digit to outputlist is so you wouldn’t get a NullPointerException or an error where there isn’t anything for the program to do with something.

Line 14 executes if line 13 is True. It just adds the value to outputlist.

Line 16 just returns outputlist.

There you go. You have the sorted list now.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.