English
Tamil Nadu Board of Secondary EducationHSC Science Class 12

How will you access the list elements in reverse order?

Advertisements
Advertisements

Question

How will you access the list elements in reverse order?

Short/Brief Note
Advertisements

Solution

  • Python enables reverse or negative indexing for the list elements.
  • Thus, python lists indexes in the opposite order.
  • The python sets -1 as the index value for the last element in the list and -2 for the preceding element and so on. This is called Reverse Indexing.

Example: Age = [15,20,29,45,60]

Age 15 20 29 45 60
Positive index 0 1 2 3 4
Negative index -5 -4 -3 -2 -1
shaalaa.com
Introduction to List
  Is there an error in this question or solution?
Chapter 9: Lists, Tuples, Sets and Dictionary - Evaluation [Page 168]

APPEARS IN

Samacheer Kalvi Computer Science [English] Class 12 TN Board
Chapter 9 Lists, Tuples, Sets and Dictionary
Evaluation | Q 2. | Page 168
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×