python 'string index out of range' error
<p>I'm trying to code a word scrambler but when I try to append letters from my word, using index, I get the error 'String index out of range'. I have tried this without the 'input' but once I added it in I started getting problems.
my code is:</p>

<pre><code>a = input('word -&gt;')
b = []
count = 0
while count &lt; 5:
    b.append(a[count])
    count +=1
print(b)
</code></pre>

<p>it would be great if someone could help. thanks</p>

<p>The problem is that your "count" will increase each loop until it reaches 5. If the string in the input is shorter than 5, you will get index error.</p>

python indexing syntax range