I have some code which chooses a random word from a list of words and displays it on a label. The user then has to retype this word correctly to score a point. I decided to use a text file to store the words and read it into a list in the program but this is causing problems.
try:
    from tkinter import *
except ImportError:
    from Tkinter import *
import random
with open("WORDS_FILE.txt") as f:
    WORDS = list(f.readlines())
word_count = 0
def shuffle():
    global word
    go_btn.pack_forget()
    while word_count < 4:        
        word = random.choice(WORDS)        
        label.config(text=str(word))    
        return
def check(event):
    global word, word_count
    if entry.get().lower() == word.lower():
        update_right()
    elif entry.get().lower() != word.lower():
        update_wrong()
    shuffle()
    entry.delete(0, END)
def update_right():
    global word, word_count
    word_count += 1
    WORDS.remove(word)    
    wrong_label.config(text="")
def update_wrong():
    global word, word_count
    wrong_label.config(text="WRONG!", fg='red')
root = Tk()          
label = Label(root, font=("Helvetica", 60))
wrong_label = Label(root, text="", font =("Helvetica, 14"))                                      
go_btn = Button(root, text="GO!", command=shuffle)
entry = Entry(root)
root.bind("<Return>", check)
label.pack()
wrong_label.pack()
go_btn.pack()
entry.pack()
entry.focus_set()
root.mainloop()
My problem is that even if I retype the word correctly, it is still always wrong. I have checked the text file and there doesn't seem to be anything wrong with. Text file is as follows:
Games
Development
Keyboard
Speed
Typer
Anything
Syndicate
Victory
 
    