title: Python index out of range work-around
body: <p>I am a beginner in coding.  I am searching for a solution to this problem:
  I am supposed to write a function that well take a string of text with words AND numbers, separated with spaces, and from that string output True if there are 3 words in a row.</p>
  
  <p>example:  </p>
  
  <pre><code>'123 a b c' == True  
  'a 123 b c' == False
  </code></pre>
  
  <p>What I have tried:  </p>
  
  <pre><code>def 3_in_a_row(words):
      words = words.split(" ")
      for i in range(len(words)):
           return words[i].isalpha() and words[i+1].isalpha() and words[i+2].isalpha()
  </code></pre>
  
  <p>If I try this I get a <code>list index out of range</code> error because when I near the end of the list, there are not 2 words after <code>i</code> to check.   </p>
  
  <p>What is the best way to limit this function so that it will stop when there are not 2 items after <code>i</code> to check?  What is a better way to do this?</p>