Level II
Modify the elements of a list
You can add things to a list! You just need to use “list.append(ITEM)” if you want it at the end or “list.insert(POSITION,ITEM)” if you want to specify where exactly you want it.
Let’s have a look:
Indeed, you can even modify a list by adding/attaching other lists to it. See:
Let’s say you want to have a long list of 10 zeros. I don’t know why, but I prefer not to ask you… You can do it!
Finally, you can also delete things from a list!
Previous lesson
Acces the elements of a list
Next lesson
Play with loops