title: How can I find if key exists in a dictionary?
body: <p>I want to write a program in python that finds a value in list.
  Something like this:</p>
  
  <pre><code>arr = [1, 14, 2, 4, 5, 11, 8, 10]
  for i in range(1, len(arr)):
      if(i * 2 in arr):
          print "!"
  </code></pre>
  
  <p>The array I want to check is way way longer so it takes really long time.<br>
  i came up with an idea to make a hash table instead of a list.
  someting like this: </p>
  
  <pre><code>arr = {1: "something", 14: "something", 2: "something", 4: "something",
         5: "something", 11: "something", 8: "something", 10: "something"}
  </code></pre>
  
  <p>My idea was to check if <code>i</code> for example equal to <code>2</code> so to check if <code>arr[i*2]</code> will return something because this way the program won't need to find something just to call it if it exists.  </p>
  
  <p>The problem is if <code>i</code> equal to <code>3</code> so it will check if <code>arr[3*2]</code> will return something, it won't because there is no key 6 and it will return an error.  </p>
  
  <p>How can I do this with my idea?</p>