Accessing list elements: indexing and slicing in Python.

Published: 06 September 2023
on channel: PatchyPython
88
0

List elements are numbered, like the houses in a street, but starting at 0 (so that the last element of a list of n elements is actually number n-1). The indexing operator (a pair of square brackets) allows you to read or write a particular element of a list; conveniently, it can also be applied to retrieve individual characters in a string. The "len" function lets you know how many elements there are in a list, and you can use an indexing technique known as "slicing" to extract entire sub-lists. 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


Watch video Accessing list elements: indexing and slicing in Python. online without registration, duration hours minute second in high quality. This video was added by user PatchyPython 06 September 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 88 once and liked it 0 people.