Find words which contain the most consonants: Difference between revisions

→‎{{header|Python}}: added word length > 10 requirement; improved efficiency (har har) by not reading dictionary file multiple times
(→‎{{header|Python}}: added word length > 10 requirement; improved efficiency (har har) by not reading dictionary file multiple times)
Line 1,862:
<lang python>import re
 
print('\n'.join(map(lambda x: f'{x[0]}: {" ".join(sorted(x[1]))}' if len(x[1]) < 5040 else f'{x[0]}: {len(x[1])} words', (filter(lambda x: x[1], reversed([(n, (lambda[x[1] for x in l if x[0] == n,]) for n in range(maxlen)])))) if (maxlen := max(l := list(sorted(([(len(c), w) for w in ([l.rstrip() for l in open('unixdict.txt') if not re.match(r'^[^a-z]+$', l) and len(l) > 10] if list(sorted(c := list(sorted(re.sub(r'[aeiou]', '', w)))) == list(sorted(set(c))))], reverse=True): [w for c,w in l if c == n])(n))[0] for+ n1) inelse range(20, -1, -1))))))None)</lang>
{{out}}
<pre>9: comprehensible
18: 27745 words
8: administrable anthropology bankruptcy ...<40 some odd words>... thunderclap
7: 293217 words
6: 1141455 words
5: 2717229 words
4: aeronautic aficionado ...<bunch of words>... univariate</pre>
4: 4310 words
3: 3964 words
2: 1956 words
1: 277 words
0: a aaa aau e i ia ieee ii iii io o u</pre>
 
=={{header|R}}==