+ 2
Append index
what's the difference between append and index
2 Respuestas
+ 2
append is a method to add element in a list for example. And once added, the element will have an index.
Here is an example
list = [1, 2, 6]
list.append(7)
[1, 2, 6, 7]
the added number 7 is at index 3
+ 5
.append(n) adds n to the list, while .index(n) just returns the place where n is in the list (first ocurrence; if it is in the list at all)