Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Index error in python which is coming in list

   >>> L1=[1,2,3]
    >>> L1[3]
    Traceback (most recent call last):
    File "<pyshell#18>", line 1, in <module>
                
   
    
    IndexError: list index out of range

hey I am new to python and getting an error which i have never encountered

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>>> L1=[1,2,3]
>>> L1[2]

check this out as it starts from 0 not with 1 so here:-1 will be at index0,2 at index1,and 3 at index2

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading