mercredi 27 décembre 2017

Why my codes result 'module' object is not subscriptable?

I get an error while I wanted to change python random.sample array index. I would like to change my random.sample array index by increasing +1

x=0
randomarray = random.sample(range(1, len(codelist) - len(Genx1) - len(Genx2)), 3*len(s))


while (x < len(s)):

    randomarray.sort()
    print(randomarray)
    if ((codelist[randomarray[x]]=='B' ) and (s[x]=='A') or (codelist[randomarray[x]]=='A' ) and (s[x]=='B')):

            codelist[randomarray[x]] = s[x]
            x = x + 1

    else:

        random[x]= random[x]+1
        x=x

line 403, in ... random[x]= random[x]+1 TypeError: 'module' object is not subscriptable




Aucun commentaire:

Enregistrer un commentaire