The following code references a dict (kanji_kana) of kanji/kana words saved in a different .py file.
kanji, kana = random.choice(list(kanji_kana.items()))
for i in kanji_kana:
print(f"{kanji}, {kana}")
print(f"type the kana for {kanji}.")
answer = input("--> ")
if answer == kana:
print("right")
else:
print("wrong")
The output after two runs is as follows:
土地, とち
type the kana for 土地.
--> とち
right
土地, とち
type the kana for 土地. ## the same key/value pair shown again
-->
What I would like to do is after the user types the answer, whether right or wrong, is for the key/value pair to change to a different random pair from the dict. I want to cycle through the whole dict until all pairs are shown in the quiz.