samedi 1 octobre 2016

Python error 'string index out of range' word scrambler

I'm trying to make a word scrambler and I have came across the error 'string index out of range'. I asked about this error earlier and it got fixed but now it has came back again and for the life of me I cant figure out what it is. My code is: import random

a = input('Enter word ->')
rand = []
before = []
after = []
count = 0
while count <= len(a):
    z = len(a)
    rand.append(random.randint(1,z))
    before.append(a[count])
    count += 1


print(rand, before, inp)

id really appreciate it if anyone could help. thanks




Aucun commentaire:

Enregistrer un commentaire