title: Python not recognizing all elements of a list
body: <p>I am trying to make a molar mass calculator using python 2.7. My current program works by asking for user input of a chemical formula, such as "C 6 H 12 O 6."<br>
  Then, the program turns the input into a list, and then separates the numbers from the characters. To do that, the user list is compared to the element list.<br>
  If a character matches up with an element, the program appends that element to a separate list. However, for some reason, 24 (originally 49) elements are not recognized as being in the list of elements, and therefore are not appended onto the new list.<br>
  For example, the program doesn't append "Mg" or "Al" to the new list. I have decreased the list of unrecognized elements from 49 to 24 by converting my lists and the input to uppercase with upper().<br>
  However, the 24 elements still do not get recognized. Below is the code that I believe is the problem.</p>
  
  <pre><code>reflistchar = ['H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne','Na', 'Mg'] 
  #A separate loop converts each element to uppercase. Shortened for simplicity.
  
  s1 = raw_input('Formula: ')
  s = s1.upper()
  slist = s.split(' ')
  
  x = len(slist)
  y = 0
  for i in range(x):
  if any(i in reflistchar for i in slist[y]):
    slchar.append(slist[y])
  y += 1
  </code></pre>
  
  <p>For example:</p>
  
  <p>Input:</p>
  
  <pre><code>element1 element2 element3 element4 element5
  </code></pre>
  
  <p>Expected Output:</p>
  
  <pre><code>[element1, element2, element3, element4, element5]
  </code></pre>
  
  <p>Current Output:</p>
  
  <pre><code>[element2, element3, element5]
  </code></pre>
  
  <p>As I tried to show above, the user inputs 5 elements but only some of them are added to the list. The elements that are not added are consistently not added no matter what order they are inputted in.<br>
  I think this may be because these elements denote some sort of python function or variable. I greatly appreciate any advice on how to get the program to recognize them. </p>