1# Python program to sort a list of tuples by the second Item
2
3# Function to sort the list of tuples by its second item
4def Sort_Tuple(tup):
5 # Getting length of list of tuples
6 lst = len(tup)
7 for i in range(0, lst):
8 for j in range(0, lst-i-1):
9 if (tup[j][1] > tup[j + 1][1]):
10 temp = tup[j]
11 tup[j]= tup[j + 1]
12 tup[j + 1]= temp
13 return tup