मराठी
तामिळनाडू बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान इयत्ता १२

How will you access the list elements in reverse order? - Computer Science

Advertisements
Advertisements

प्रश्न

How will you access the list elements in reverse order?

टीपा लिहा

उत्तर

  • 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
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 9: Lists, Tuples, Sets and Dictionary - Evaluation [पृष्ठ १६८]

APPEARS IN

सामाचीर कलवी Computer Science [English] Class 12 TN Board
पाठ 9 Lists, Tuples, Sets and Dictionary
Evaluation | Q 2. | पृष्ठ १६८
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×