Reputation: 1
my friend and i are studying words and their meaning and i need help trying to get the word that we want to learn about. I have a list of words that we type into the command line that will tell the computer we want the meaning or history of the word we want. My problem is finding out which word we typed in. here is my code so far:
Meaning = {"Meaning", "define", "history"}
text1 = raw_input("Text: ")
tokens = commands.lower().split()
if Meaning.intersection(tokens):
#Here is the problem, because i don't know what word we might type
#so i need it to check the word after the Meaning. How can i do this?
I am using the program to type into a website and get information on the word, so i can't add the word and the definition because it would be too hard to do every word i know. How can i get the word after the meaning?, Thank you.
Upvotes: 0
Views: 143
Reputation: 653
Set up your dictionary as set of pairs.
terms = {'word1': 'meaning', 'word2': 'othermeaning'}
print terms['word1']
Upvotes: 1