How to implement Selection Sort within a list?
So I've got a .txt file as follows: 131,263.07 47,170.14 170,190.01 180,412.69 53,401.53 And I had to read the file so as to output the list like: 131 kms, $263.07 47 kms, $170.14 170 kms, $190.01 180 kms, $412.69 53 kms, $401.53 The code I used was: def PrintList(table): for line in table: print(str(line[0]) + " kms, $" + str(line[1])) file = open(input("Enter file name: ")) table = [] for line in file: line = line.rstrip().split(",") line[0] = int(line[0]) line[1] = float(line[1]) table.append(line) PrintList(table) file.close() And now I'd like to sort the list in increasing order of price