2 ms·
> There's probably some itertools trick to do it with only one iteration. Or an arithmetic trick. Since there's the `1 if ('G' in line or 'C' in line) else 0 f
by jhgb 5y ago
> There's probably some itertools trick to do it with only one iteration.
Or an arithmetic trick. Since there's the `1 if ('G' in line or 'C' in line) else 0 for line in lines` construct in the code, if you simply replace 1 with (len(line)<<K)+1 and 0 with len(line)<<K (for a suitable value of K), you can extract the two results using div/mod.