Merge list into list of tuples of 4 items

  list, python, tuples

list I want to merge

l = [3.23, 5.32, 8.23, 2.23, 9.98, 7.43, 6.43, 8.23, 4.23]

list has to be from high to low

l.sort()
l.reverse

I need as result

p = [(9.98, 8.23, 8.23, 7.43), (6.43, 5.32, 4.23, 3.23), (2.23,)]

Can someone help me how to do this in python?

Source: Python Questions

LEAVE A COMMENT