bonsoir à tous,
voila, j'ai un problème de compréhension sur les liste. quand j'éxecute le code suivant j'ai un affichage qui me signale une erreur sur mon indexation de tableau.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 x = [0,1,2,-1,-2 ] y = [] for i in range(len(x)): y[i]= 3* x[i] + 1
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 5 y = [] 6 for i in range(len(x)): ----> 7 y[i]= 3* x[i] + 1 8 IndexError: list assignment index out of range
Partager