[Tutor] Consecutive Sequence

Dave Angel d at davea.name
Wed Oct 17 14:02:58 CEST 2012

On 10/13/2012 07:02 AM, syed zaidi wrote:
> Hi,I am trying to develop a python code that takes a character string as input and  finds for the occurrence of letters that are occurring thrice or more consecutively.For E.g.
> a = 'atttttaattaaacagagtgagcagaaaat'In the output I want a list of those characters that are occuring thrice or more.
> like in this case outout must b out_put = ['ttttt','aaa','aaaa']
> Can someone please suggest a code for this. 		 	   		  

Is this a homework assignment where you might be expected to build a
complex loop, or is it a problem you're solving where you would be
allowed to use itertools.groupby ?



More information about the Tutor mailing list