Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- does_not_contain = set()
- does_contain = set()
- def check_contains(word):
- for char in does_contain:
- if char not in word:
- return False
- return True
- def check_does_not_contain(word):
- for char in does_not_contain:
- if char in word:
- return False
- return True
- def check_exact(word):
- x = 0
- while x < len(exact):
- if exact[x].isalpha() and exact[x] != word[x]:
- return False
- x += 1
- return True
- def check_exact_mismatch(word):
- x = 0
- while x < len(exact_mistmatch):
- if exact_mistmatch[x].isalpha() and exact_mistmatch[x] == word[x]:
- return False
- x += 1
- return True
- with open("filtered_words.txt", "r") as file:
- word_list = file.read().split()
- while True:
- word = input("Word Entered: ")
- grey = input("Greys: ")
- yellow = input("Yellows: ")
- green = input("Greens: ")
- for char in grey:
- does_not_contain.add(char)
- for char in yellow+green:
- does_contain.add(char)
- word = list(word)
- exact, exact_mistmatch = word.copy(), word.copy()
- for i in range(len(word)):
- if word[i] not in green:
- exact[i] = "0"
- if word[i] not in yellow:
- exact_mistmatch[i] = "0"
- rem_words = []
- for x in word_list:
- if (check_contains(x) and check_does_not_contain(x) and check_exact(x) and check_exact_mismatch(x)):
- rem_words.append(x)
- word_list = rem_words.copy()
- print(word_list)
- # Great -ans
- # Treat - try
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement