Create a Python program to sort a list of tuples based on the second elements of the tuples.
l = [(1, 3), (2, 5), (4, 1), (6, 4)]
def sortTuples(l): 
    l.sort(key = lambda x: x[1]) 
    return l
 
# Sample Output 
# [(4, 1), (1, 3), (6, 4), (2, 5)] 
print(sortTuples(l))