From 98dc0984cf53cc40d0fce9487564c9df4defdc32 Mon Sep 17 00:00:00 2001 From: Dimitri Merejkowsky Date: Sat, 1 Dec 2018 18:16:16 +0100 Subject: [PATCH] pendu.py: cosmetic changes --- sources/04-pendu.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sources/04-pendu.py b/sources/04-pendu.py index d941b4d..1a63413 100644 --- a/sources/04-pendu.py +++ b/sources/04-pendu.py @@ -3,6 +3,7 @@ import random def read_words(): stream = open("noms.txt") words = stream.read().splitlines() + stream.close() return words @@ -13,7 +14,10 @@ def choose_word(words): def has_won(word, letters): - return set(word) == letters + for letter in word: + if letter not in letters: + return False + return True def display_hint(word, letters):