+ 2
Would you help me to know 2 lines logic ?
Hi friends Anyone may help me on lines 3 & 4 Line.3 : I cannot reason for myself this line output (why this output happened) Line.4: I want to know descriptively this line logic. https://code.sololearn.com/cYB7Kk3zlN8m/#py
4 Answers
+ 1
is this the right code? line 10 is empty
+ 1
the code basically takes lists within a list and sorts then in reverse but prints the state the past iteration and not the current one.
+ 1
I meant lines 3 & 4
0
explained it above but will say it more simple
row3: prints the entire list that you pass into the function, but it will print it before the sorting so you will never see the sorting of the last item unless you print it outside the loop. or move print below the sort.
row4: sorts the items in the list in turn in reversed order, normally its from lowest to highest. Since its a for loop it iterates items in the passed data. even though you print the entire list it changes values in the lists(rows) within two_lists