title: How to check all the integers in the list are continuous?
body: <p>I am trying to write a program which will print "YES" if all the numbers in the <code>list</code> are continuous and should return "NO" if the numbers are not continuous. By continuous I mean every number in the list should be greater than one from the previous element.</p>
  
  <p>For example:</p>
  
  <ul>
  <li><p>It should print "YES" for inputs: <code>[3, 4, 5]</code>, <code>[7, 8, 9]</code>, <code>[1, 2, 3]</code>, <code>[0, 1, 2, 3, 4, 5]</code>.. etc</p></li>
  <li><p>It should print "NO" for inputs: <code>[9, 1, 0]</code>, <code>[3, 2, 4]</code>, <code>[5, 5]</code>, <code>[9, 8, 2, 3, 7]</code>.. etc</p></li>
  </ul>
  
  <p>I used <code>enumerate</code> for this purpose.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>    inp=[1,2,3,4,5]
      flag=0
      for index,e in enumerate(inp): 
          if index!=len(inp)-1:    
              if inp[index+1]==inp[index]+1:
                  flag=1
      if flag==1:
          print ("YES")
      else:
          print ("NO")
  </code></pre>
  
  <p>The code works fine but i find it redundant.<br>
  Is there a better way to do it using enumerate or without using enumerate?</p>