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>I'm not sure what you are trying to achieve here, but look at this:</p>

<pre><code>word = input('word -&gt; ')
b1 = []
# Iterate over letters in a word:
for letter in word:
    b1.append(letter)
print(b1)

b2 = []
# Use `enumerate` if you need to have an index:
for i, letter in enumerate(word):
    # `i` here is your `count` basically
    b2.append(letter)
print(b2)

# Make a list of letters using `list` constructor:
b3 = list(word)
print(b3)

assert b1 == b2 == b3
</code></pre>

python indexing syntax range