title: Print a range of lines from a text file
body: <p>I have a text file (the U.S. constitution) and I want to print just the preamble. Here's the code I have so far:</p>
  
  <pre><code>lines = []
  with open('Constitution.txt') as fhand:
      for line in fhand:
          lines.append(line.rstrip('\n'))
          print(lines[4:10])
          break
  </code></pre>
  
  <p>If, on the 5th line of code I type<code>print(lines[0])</code>, it works, and prints just the first line of the text, which is simply the word "THE". But I want it to print lines 5-11, which is the preamble, but it always comes back saying the index is out of range... How can I fix this?</p>