I'm a bit new to python and I'm trying to create a simple program which adds words and definitions to a list, and then calls them forward when asked to.
------------------------------------------------------------------------------- choice = 0 words = [] entry = 0 definition = 0 escape = 0 finish = 0 memory = 0 dictionary = [] search = 0 def ask_ok(prompt, retries=2, complaint='Yes or no, please!'): while True: ok = input(prompt) if ok in ('y', 'ye', 'yes'): return True if ok in ('n', 'no', 'nop', 'nope'): return False retries = retries - 1 if retries < 0: raise IOError('refusenik user') print(complaint) print("Welcome to Digital Dictionary V1.0!\n\n") while escape < 1: choice = input("Type 'Entry' to add a word to the Dictionary, 'Search' to find a word, and 'Exit' to quit. ") if choice == '`': break if choice == 'Entry' or 'entry': while finish < 1: entry = input("Please type the word you wish to add: ") words.append(entry) definition = input("What does the word mean?\n ") dictionary.append(definition) print(entry, '\n', definition) ask_ok("Is this entry complete? ") if True: finish = 1 entry = 0 definition = 0 elif choice == 'Search' or 'search': search = input("Please type the word you wish to find: ") print(search in words) elif choice == 'Exit' or 'exit': ask_ok("Are you sure you want to exit? ") if True: escape = 1 else: print("Please choose an option from the list.") ------------------------------------------------------------------------------- However, if I run the program using anything but 'entry', the program still runs the 'entry' subroutine. After the 'entry' subroutine is run once, no options work. Ex: ------------------------------------------------------------------------------- >>> Welcome to Digital Dictionary V1.0! Type 'Entry' to add a word to the Dictionary, 'Search' to find a word, and 'Exit' to quit. entry Please type the word you wish to add: computer What does the word mean? a device for computing computer a device for computing Is this entry complete? yes Type 'Entry' to add a word to the Dictionary, 'Search' to find a word, and 'Exit' to quit. search Type 'Entry' to add a word to the Dictionary, 'Search' to find a word, and 'Exit' to quit. exit Type 'Entry' to add a word to the Dictionary, 'Search' to find a word, and 'Exit' to quit. ` >>> ------------------------------------------------------------------------------- The only option which seems to work is the '`' subroutine, which I added to stop the program after running for a while. I believe it works because it was added before the 'entry' subroutine. If anyone can help me figure out why it won't run properly, I'd be really grateful. P.S: I haven't finished the 'search' subroutine, but I just want to get this small problem solved soon so I can -- http://mail.python.org/mailman/listinfo/python-list