title: String Slicing and Inverting String in Python
body: <p>While I was studying string slicing, skipping of characters of a string and inverting a given string, I stumbled upon the following doubt:</p>
  <pre><code>var = 'abcdefghijklmnopqrstuvwxyz'
  print(var[-20:-4])          # Works         # '-4' is w
  print(var[-4:-20])                          # '-20' is g
  print(var[-20:-4:1])        # Works         # '-19' is h
  print(var[-20:-4:-1])                       #'-5' is v
  print(var[-4:-20:1])
  print(var[-4:-20:-1])       # Works
  </code></pre>
  <p>Here out of the 6 <code>print</code> commands, only 3 of them worked and gave an output.</p>
  <p>Output:</p>
  <pre><code>ghijklmnopqrstuv
  (No output just a blank line)
  ghijklmnopqrstuv
  (No output just a blank line)
  (No output just a blank line)
  wvutsrqponmlkjih
  
  </code></pre>
  <p>Q1) Why didn't the other work. Which format works and which doesn't.</p>
  <p>Q2) Before this doubt I used to believe that the first 2 numbers (-4 and -20 in this example) were supposed to be entered in ascending order, and that is true as we can see in the very first <code>print</code> command. But then when I try to invert the first command by adding a -1 after the colon, it does not produce any output. What could be the reason behind this?</p>
  <p>If you have any other tips on how to invert strings without errors please share.</p>