How to access the last element of the list?

14. How to access the last element of the list?

  1. Print L1[last index]
  2. Print L1 [-1]
  3. Print L1 [-LAST INDEX]

Answer: B) Print L1 [-1]

Explanation:

To access the last element directly of the list we can use the following syntax: List name[-1].

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.