title: Inserting characters in strings in python
body: <p>I'm doing homework and I have all except this last problem figured out. I can't seem to figure out how to get a character not to show up if it's inserted at a larger insertion point than the string has. This is the problem I'm working on:</p>
  <blockquote>
  <p>Write a program insert.py that simulates insert behavior on a string.</p>
  <p>The program takes three inputs: a character to be inserted, its position, and a string into which a character is to be inserted. The program prints the new version of the string. For example, if the arguments are: -, 2, below, then the program prints be-low. If a position passed to the program is outside of the bounds of the original string (in this case &lt;0 or &gt;5 -nothing would append on the end of below), then print the original string, without any changes (Note: an insert value of 0 OR the length of the string will add to the start or append to the end, i.e. T, 3, can will be canT; T, 0, can will be Tcan, and T, 4, can will be can).</p>
  </blockquote>
  <p>This is what I have done so far:</p>
  <pre><code>C = input(&quot;Choose your charecter to insert. &quot;)
  P = int(input(&quot;Choose your character's position. &quot;))
  S = input(&quot;Choose your string. &quot;)
  st = S[:P] + C + S[P:]
  
  print(st)
  print(C, P, S)
  </code></pre>