I'm looking to create a Python based vocabulary checker for my little cousin to use for studying. The purpose of the program will be to display a word and then she will need to type in the definition and have it checked. I was wondering if the best way to do this is with array lists:
vocab = ['Python','OSX']
definition = ['programming language','operating system']
Is this the best way to go about this? And if so how do I have the program randomly display a vocab and then check the definition. Any help would be greatly appreciated. Thank you guys.
Ok. So this is what I have so far.... #Russian Translation Program
import os
import random
#Asks users if they want to add more vocabulary
word_adder=raw_input("Add more words? If yes, press 1: ")
with open("Russian_study.txt","a") as f:
while word_adder=="1":
word=raw_input("Enter word: ")
translation=raw_input("Word translation: ")
f.write("'{0}':{1},".format(word,translation))
word_adder=raw_input("Add another word? If yes, press 1: ")
#Checks to see if file exists, if not one is created
with open("Russian_study.txt","a") as f:
pass
os.system('clear')
print("Begin Quiz")
#Begin testing user
with open("Russian_study.txt","r") as f:
from random import choice
question = choice(list(f))
result = raw_input('{0} is '.format(question))
print('Correct' if result==f[question] else ':(')
However, my output is
Begin Quiz
'Один':'One', is
How do I make it only display Один and check the user input against one?