jeudi 2 novembre 2017

Print list when I have two P after each other

Hello I'm trying to make a code (to stop when I have two P) but it makes me : TypeError: 'NoneType' object is not subscriptable Thanks for your help ! My code :

import random as rd
def experience ():
    L=[]
    L.append(rd.choice(['P','F']))
    L.append(rd.choice(['P','F']))
    a=0
    b=1
    while L[a]!=L[b]!='P':
        a=b
        b=b+1
        L.append(rd.choice(['P','F']))
    return L




Aucun commentaire:

Enregistrer un commentaire