Important Notice:

Course Content
List Manipulation in Python (Chapter-7) M3-R5
About Lesson
Accessing Element of List:-

                     list से data access करने के 2 method का use किया जाता है-

  1. By using index number
  2. By using slice operator

 

1. By using index number:-    

List1

10

20

30

40

50

60

Postive index

0

1

2

3

4

5

Negative index

-6

-5

-4

-3

-2

-1

Note:- पायथन positive & Negative दोनों तरह की indexing को support करता है

positive index को अर्थ left to right होता है

print(list1[0])                         # 10

print(list1[3])                         # 40

 negative index का अर्थ right to left होता है-

print(list1[-1])                    #60

print(list1[-3])                    #40

 

Accessing Element of List:-

                  Two methods are used to access data from the list-

  1. By using index number
  2. By using slice operator

 

  1. By using index number:-       

List1

10

20

30

40

50

60

Postive index

0

1

2

3

4

5

Negative index

-6

-5

-4

-3

-2

-1

Note:- Python supports both positive & negative indexing.

positive index means left to right

print(list1[0])                         # 10

print(list1[3])                        # 40

 Negative index means right to left

print(list1[-1])                      #60

print(list1[-3])                      #40

error: Content is protected !!