title: Why do I get the error "'function' object is not subscriptable'
body: <p>This is my code block</p>
  
  <pre><code>import json
  import difflib
  from difflib import get_close_matches
  
  definitions = json.load(open("data.json"))
  
  def thesaurus(words):
      if words in definitions:
          return definitions[words]
      elif len(get_close_matches(words, definitions.keys())) &gt; 0:
          yn = input("Did you mean %s instead? Enter 'Y' if yes or 'N' if no: " % get_close_matches(words,definitions.keys()) [0])
          if yn == "Y":
              return thesaurus[get_close_matches(words, definitions.keys())]
          elif yn == "N":
              return "None found"
      else:
          return "Please check word again"
  
  
  words = input("Look Up: ").lower()
  
  print(thesaurus(words))
  </code></pre>
  
  <p>I expected to receive the meaning of the word "Grief". However, I kept receiving the error : function object is not subscriptable. </p>
  
  <p>Here is the terminal log, just in case it might help:</p>
  
  <pre><code>My-MacBook-Pro:Python Adwok$ python3 dictionary.py
  Look Up: GRERFAG
  Did you mean grief instead? Enter 'Y' if yes or 'N' if no: Y
  Traceback (most recent call last):
    File "dictionary.py", line 22, in &lt;module&gt;
      print(thesaurus(words))
    File "dictionary.py", line 13, in thesaurus
      return thesaurus[get_close_matches(words, definitions.keys())]
  TypeError: 'function' object is not subscriptable
  </code></pre>
  
  <p>Please point out even the smallest details, I would appreciate that very much. </p>