title: How to check last three elements from a python list - whether they are integer?
body: <p>I am using Python, version 2.7.2.</p>
  
  <p>I have a task to check whether the last three elements from a list are integer?
  For example:</p>
  
  <pre><code>mylist = [String, Large_string_containing_integers_inside_it, 80, 40, 50]
  </code></pre>
  
  <p>For above list I want to check whether the last three elements are integer or not.
  How can I do this?</p>
  
  <p>Here is the code I am testing:</p>
  
  <pre><code>#!/usr/bin/python
  
  line = ['MKS_TEST', 'Build', 'stability:', '1', 'out', 'of', 'the', 'last', '2', 'builds', 'failed.', '80', '40', '50']
  
  if all(isinstance(i, int) for i in line[-3:]):
      job_name = line[0]
      warn = line[-3]
      crit = line[-2]
      score = line[-1]
      if score &lt; crit:
          print ("CRITICAL - Health Score is %d" % score)
      elif (score &gt;= crit) and (score &lt;= warn):
          print ("WARNING - Health Score is %d" % score)
      else:
          print ("OK - Health Score is %d" % score)
  </code></pre>