Negative Indexing lists in Python to prevent index out of range

Negative Indexing lists in Python to prevent index out of range

Python for Everyone

8 месяцев назад

174 Просмотров

To get the the last element of a list, you have to use the length of the list and subtract one. But what if Python can do this for you? Yes, negative indexing is just that!

C H A P T E R S
0:30 Get the last element by index
1:40 Last element by using the length of the list
1:58 Last element by using a negative index

M Y O N L I N E T R A I N I N G
🎓Want to learn more tips and tricks about Python lists? Enroll in my udemy course here: https://pythonforeveryone.com/python-intermediate-lists-online-training.html

#negativeindex #programming #python

Тэги:

#Python #Learn_how_to_program
Ссылки и html тэги не поддерживаются


Комментарии: