Finally store the profits of all the transactions
while ( len ( transaction ) != 0 ) : NEW_LINE INDENT profits . append ( prices [ transaction [ len ( transaction ) - 1 ] [ 1 ] - 1 ] - prices [ transaction [ len ( transaction ) - 1 ] [ 0 ] ] ) NEW_LINE transaction . remove ( transaction [ len ( transaction ) - 1 ] ) NEW_LINE DEDENT profits . sort ( reverse = True ) NEW_LINE