Handling Python lists: methods for adding and retrieving elements (and sorting, reversing, etc)

Опубликовано: 02 Апрель 2026
на канале: PatchyPython
117
0

Try this code in your browser: click here
https://tinyurl.com/5cud7uzd

I introduce a few list methods, that allow you to perform basic operations on lists, such as adding items to a list, sorting them, removing them, concatenating lists and clearing them. In detail:
append - add an element
extend - add all the elements of another list
remove - delete a specific element
pop - return the element at the given position and delete it
reverse - invert the order of elements
sort - sort the list
clear - remove all elements.

For more information and to try out the code, click on the link above - a notebook will open in your browser, no need to install Python on your machine.

Embedded video, also part of the following courses:
Computer Programming at Queen Mary, University of London
FREE Colab notebook: https://tinyurl.com/3xjmpf94
Coding for Scientists at Queen Mary, University of London
FREE Colab notebook: https://tinyurl.com/yedumefr