Re: [Tutor] Clubbing simillar elements together in a list with repeating elements

2011-02-24 Thread Hugo Arts
Won't give you all the ansers, but here's a few tips. On Thu, Feb 24, 2011 at 12:29 PM, ranjan das wrote: > > I have a list > > a=[1,2,3,4,2,5,5,4,6,7,8] > > I want to club the repeating elements together and my output should be > something like > > a_new=[ [1], [2,2], [3], [4,4] , [5,5,5],[6], [

[Tutor] Clubbing simillar elements together in a list with repeating elements

2011-02-24 Thread ranjan das
I have a list a=[1,2,3,4,2,5,5,4,6,7,8] I want to club the repeating elements together and my output should be something like a_new=[ [1], [2,2], [3], [4,4] , [5,5,5],[6], [7], [8]] How do I do this? I tried the following but it is not giving me the desired result a=[1,2,3,2,3,4,5,4,5,5,6]