testorz = [ 10.0/3.0, 5.0/3.0, 1.0/3.0 ] for val in testorz: s = str(val).split('.')[1] print '\nval = ',val print 's = ', s for i in xrange(len(s)/2): if(len(s.replace(s[0:i],''))==0): print 'repeating', s[0:i] break; else: print 'notrepeating'