Jump to content

ABC words: Difference between revisions

Python alternative
m (→‎{{header|Diego}}: Syntax on index brackets)
(Python alternative)
Line 2,487:
(54, 'tabernacle')
(55, 'tablecloth')</pre>
 
Or using a regular expression.
 
<lang python>import re
import textwrap
 
RE = re.compile(r"^([^bc\r\n]*a[^c\r\n]*b.*c.*)$", re.M)
 
with open("unixdict.txt") as fd:
abc_words = RE.findall(fd.read())
 
print(f"found {len(abc_words)} ABC words")
print(textwrap.fill(" ".join(abc_words)))</lang>
 
{{out}}
<pre>
found 55 ABC words
aback abacus abc abdicate abduct abeyance abject abreact abscess
abscissa abscissae absence abstract abstracter abstractor adiabatic
aerobacter aerobic albacore alberich albrecht algebraic alphabetic
ambiance ambuscade aminobenzoic anaerobic arabic athabascan auerbach
diabetic diabolic drawback fabric fabricate flashback halfback iambic
lampblack leatherback metabolic nabisco paperback parabolic playback
prefabricate quarterback razorback roadblock sabbatical snapback
strabismic syllabic tabernacle tablecloth
</pre>
 
=={{header|Quackery}}==
140

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.