parent
a7b1deb431
commit
456a5c7d8f
|
@ -1,3 +0,0 @@
|
||||||
# wordle-cheater
|
|
||||||
|
|
||||||
Zeige alle Wörter, die mit den angegebenen Buchstaben gebildet werden können.
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
import sys
|
||||||
|
|
||||||
|
try:
|
||||||
|
words = open("/usr/share/dict/ngerman", "r")
|
||||||
|
except:
|
||||||
|
print("/usr/share/dict/ngerman nicht gefunden. Paket \"wngerman\" nicht installiert?")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
print("Syntax: python3 words.py abc")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
letters = []
|
||||||
|
for letter in sys.argv[1]:
|
||||||
|
if letter not in letters:
|
||||||
|
letters.append(letter)
|
||||||
|
|
||||||
|
print("Suche nach Wörtern mit folgenden Buchstaben: ", letters, "\n")
|
||||||
|
|
||||||
|
matches = []
|
||||||
|
|
||||||
|
for word in words:
|
||||||
|
match = True
|
||||||
|
for letter in letters:
|
||||||
|
if letter not in word:
|
||||||
|
match = False
|
||||||
|
break
|
||||||
|
|
||||||
|
if match:
|
||||||
|
matches.append(word)
|
||||||
|
|
||||||
|
print(matches)
|
Loading…
Reference in New Issue