title: Why do I get "IndexError: string index out of range"?
body: <p>I'm currently a beginner to python and coding in general.</p>
  
  <p>I am doing this quiz online which tasks you to remove signs (*_`~) from the front and end of a string. Eg.(~~hidden ~ tilde~~ will be changed to hidden ~ tilde) keeping the sign in the middle.</p>
  
  <p>This is my code:</p>
  
  <pre><code>string = input()
  signs = " *_`~ "
  for sign in string:
      if sign in signs:
          if sign == string[0]:
              string = string.lstrip(sign)
              string = string.rstrip(sign)
  print(string)
  </code></pre>
  
  <p>Which gets this error: IndexError: string index out of range</p>
  
  <p>I'm just a noob trying to get started on python..plz help :(</p>