title: Python search dictionary keys for search input
body: <p>So here's my question:</p>
  
  <p>I want to search a dictionary to see if any key contains a user-inputted keyword. For example, the user searches for John.</p>
  
  <pre><code>elif option == 3:
          count = 0
          found = None
          search_key = input("What do you want to search for? ").lower()
          for key, val in telephone_directory.items(): #takes each element in telephone directory
              if search_key in key: #checks if it contains search_key
                  if found is None:
                      found = val
                      count = 1
                  if found is not None:
                      print(" ")
                      print("More than one match found. Please be more specific.")
                      print(" ")
                      count = 2
                      break
  
              if found is None:
                  print("Sorry, " + str(search_key) + " was not found.")
                  print(" ")
                  function_options() #redirects back
  
              if found is not None and count &lt; 2:
                  print(str(search_key) + " was found in the directory.")
                  print("Here is the file on " + str(search_key) + ":")
                  print(str(search_key) + ":" + " " + telephone_directory[search_key])
                  print(" ")
                  function_options() #redirects back  
  </code></pre>
  
  <p>So this is where I am right now. Whatever the search may be, even if it is the entire key, it returns "was not found". What am I doing wrong?</p>