def maketup(lst):

    if len(lst) == 1:
        return lst[0]

    elif len(lst) == 2:
        return (lst[0],lst[1])

    elif len(lst) > 2:
        return ( (maketup(lst[:-2]), lst[-2]), lst[-1])

maketup(lst)

((((1, 2), 3), 4), 5)

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to