Skip to content

Commit 75d5755

Browse files
committed
Use any() with generator for invalid word check
1 parent f75d7ea commit 75d5755

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

backend/games/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def post(self, request, date):
8080
return Response({"error": "Duplicate words submitted."}, status=400)
8181

8282
legal_words = set(game.possible_words)
83-
invalid = [w for w in normalized if w not in legal_words]
84-
if invalid:
83+
if any(w not in legal_words for w in normalized):
84+
invalid = [w for w in normalized if w not in legal_words]
8585
return Response(
8686
{"error": "Invalid words submitted.", "invalid_words": invalid}, status=400
8787
)

0 commit comments

Comments
 (0)