I'm learning python, and trying to write a code that will present to the user randomly selected word from a pool, and ask him to write the translation for this word. If user translate the word correctly, the word should be deleted from the pool.
Thank you for any help.
dic = {
"key1": "val1",
"key2": "val2",
"key3": "val3"
}
import random
for keys, values in dict(dic).items():
a = []
a.append(random.choice(list(dic)))
translation = input(f"what is the translation for {a}")
translation.replace("'", "")
if a[0] == translation:
del dic[keys]
This is the code I write, but even when the condition is occurs, the word is not deleted from the pool.