Last active
June 3, 2020 14:06
-
-
Save tpaschalis/1f6e70e1a12960a2ac3e3ce7c32c4401 to your computer and use it in GitHub Desktop.
Words that are also hex numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def is_hex(word): | |
match = re.match("^[a-f]*$", word) | |
return match is not None | |
with open('/usr/share/dict/american-english') as file: | |
lines = file.readlines() | |
for item in lines: | |
if is_hex(item.lower()) and len(item)>2: | |
print(item) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment