Skip to content

Commit

Permalink
Merge pull request #2 from donat-konan33/dictionary-api
Browse files Browse the repository at this point in the history
change return to True to self.__check_dictionary(word)
  • Loading branch information
donat-konan33 authored Oct 9, 2024
2 parents ef3f397 + 6276682 commit ae0db55
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 2 deletions.
9 changes: 8 additions & 1 deletion longest_word/game.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import string
import random
import requests

class Game:
def __init__(self) -> list:
Expand All @@ -18,4 +19,10 @@ def is_valid(self, word):
letters.remove(letter)
else:
return False
return True
return self.__check_dictionary(word)

@staticmethod
def __check_dictionary(word):
response = requests.get(f"https://dictionary.lewagon.com/{word}")
json_response = response.json()
return json_response['found']
Loading

0 comments on commit ae0db55

Please sign in to comment.