def glossary():
print("Menu for glossary\n Type 1 to insert a new word\n Type 2 to lookup a word\n Type 3 to exit\n")
answer = input("Write your answer here: ")
if answer == "1":
Insert()
elif answer == "2":
lookup()
elif answer == "3":
return
else:
print("\nTry again!\n")
glossary()
def insert():
words = []
descriptions = []
word = input("Type the word you want to add: ")
words.append(word)
description = input("Descripe the word you want to add: ")
descriptions.append(description)
return words, descriptions
def lookup():
words = insert()
descriptions = insert()
print(words,"\n", descriptions)
Hi, I am trying to create a glossary in python without using tuplers or a dictionary. The glossary should be made up of two lists of strings. One list for a word and the other for the description of that word. The user will get two options, either insert a new word with a description or lookup the description of a word already in the glossary. The operations insert and lookup should be in separate functions as it is in my code. The problem I run into is that when I run the program and choose 1 to insert a word everything goes smoothly and the word and its description are inserted into the lists. But then when the menu comes back and I choose 2 to look up the word I just inserted I run into problems when I try to transfer the lists into the lookup function. Because when I try to get the return values from the insert function it calls that function again. So my problem is basically to transfer the edited lists from the insert function to the lookup function without running the insert function again. As you can see the lookup function is far from finished but I got stuck on this problem.