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, see the notebooks below (notebooks will open on Google Colab - no installation required)
Embedded video, part of the following courses:
Computer Programming at Queen Mary, University of London
Jupyter notebook: https://tinyurl.com/3xjmpf94
Coding for Scientists at Queen Mary, University of London
Jupyter notebook: https://tinyurl.com/yedumefr
Смотрите видео Handling Python lists: methods for adding and retrieving elements (and sorting, reversing, etc) онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь PatchyPython 07 Сентябрь 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 85 раз и оно понравилось 0 людям.