mardi 7 septembre 2021

how to save the output of a if statement in a list

a = [] ;

if yn_key=='y' and KeyResp.keys == 'y':
    a = 1;
elif yn_key=='n' and KeyResp.keys == 'n':
    a = 1;

else:
    a=0;
 
Corret = sum(a);

This is my code above, and i wish to save the output of the if statement in my list a, how to do so ?

Aucun commentaire:

Enregistrer un commentaire