Home>
I want to make a four-button English word test

I made a program that tests the English words written in a txt file and their meanings, but the correct answer that is displayed when I make a mistake is displayed only with the initials. Why

I want to display correct answers when incorrect answers Applicable source code
#Read text file
source = 'English.txt'
with open (source) as f:
    data = f.read ()
E_word = re.findall ('[a-z] +', data)
ja = re.findall ('\ s. * \ n', data)
Processing to delete # \ n
j_word = []
for word in ja:
    m = re.sub ('\ t | \ n', '', word)
    j_word.append (m)
w_dict = dict (zip (E_word, j_word))
# Default --------------
print ("How many questions? The upper limit is {}". format (len (E_word)))
i = input ()
n_q = int (i)
n_t = []
rand_ind = np.random.randint (low = 0, high = len (E_word), size = n_q)
for que in range (n_q):
    q_word = E_word [rand_ind [que]]
    t_ans = w_dict [q_word]
    jw_copy = j_word.copy ()
    jw_copy.remove (t_ans)
    w_ans = random.sample (jw_copy, 3)
    ans_option = [t_ans] + w_ans
    random.shuffle (ans_option)
    for k in range (0,4):
        if ans_option [k] == t_ans:
            n_t.append (k + 1)
    print ('Q {}. {} \ n'.format (que + 1, q_word))
    for i in range (4):
        print ('{}. {} \ n'.format (i + 1, ans_option [i]))
    a = input ()
    a = str (a)
    if a == str (n_t [que]):
        continue
    else:
        print ("Sorry! \ nThe correct answer is {}". format (t_ans [que + 1]))
        sys.exit ()
print ("Congratulations!")
print (rand_ind)
print (n_t)

I divided {} and wrote it in two lines, but the results did not change.

Supplemental information (FW/tool version etc.)

Please provide more information here.