title: How to run multiple functions in order?
body: <p>This should be an easy one for experienced coders out there... I am writing a program that outputs anagrams (from a given list) from a jumbled input. I believe my code includes all the necessary functions to produce the desired result, but I cannot figure out how to make the program run the respective functions in order. A sample output is:</p>
  
  <pre><code>Please enter a jumbled word: lsitNe
  Your words are:
  silent
  listen
  enlist
  tinsel
  </code></pre>
  
  <p>This is my output, currently:</p>
  
  <pre><code>  Please enter a jumbled word: dff
  Traceback (most recent call last):
    File "/Users/edinnerman/Desktop/poop.py", line 53, in &lt;module&gt;
      main()
    File "/Users/edinnerman/Desktop/poop.py", line 5, in main
      yay_anagrams = anagramlist(lword)
  NameError: name 'lword' is not defined
  </code></pre>
  
  <p>How do I reformat my code to output all anagrams listed in a text file given a user input?
  Here is my code:</p>
  
  <pre><code> #0: Create a main function to bring all functions together for the output.
  def main():
      textfile = open('words.txt', 'r').read()
      dictionary_of_words = filename(textfile)
      yay_anagrams = anagramlist(lword)
      double_whammy = binary_search(fresh_list, ltextfile)
      answer = output()
  
  #1, 2: Take a filename as a parameter and ask user for word to unjumble. Lowercase all.
  def filename(textfile):
      ltextfile = textfile.lower()
      scrambled_eggs = input("Please enter a jumbled word: ")
      lword = scrambled_eggs.lower()
  
  #3: Create an anagram list (already lowercase) for the jumbled word.
  def anagramlist(lword):
      if lword == "":
          return([lword])
      else:
          yay_word = lword[1:]
          first_letter = lword[0]
          fresh_list = []
          for mixed_word in filename(yay_word):
              for pos in range(len(mixed_word) + 1):
                  fresh_list.append(mixed_word[:pos] + first_letter[0] + mixed_word[pos:])
              return fresh_list
  
  #4: Check if any words in anagram list match dictionary list.
  def binary_search(fresh_list, ltextfile):
      for eachword in fresh_list:
          low = 0
          high = len(list) - 1 
      while low &lt;= high:
          mid = (low + high)//2
          item = list[mid]
      if fresh_list == item:
          return True
      elif fresh_list &lt; item:
          high = mid - 1
      elif fresh_list &gt; item:
          low = mid + 1
      return False
  
  #5: Print appropriate statements.
  def output():
      if fresh_list == True:
          newlist = set()
          for item in fresh_list:
              newlist.add(item)
          print("Your words are:/n", newlist)
      if fresh_list == False:
          print("Your word cannot be unjumbled.")       
  main()
  </code></pre>
  
  <p>Please excuse some of the minor coding errors I might have in this code. </p>