Indexing of a List

Indexing of a List

Lesson Details:
September 17, 2020

Video Transcription: Now in this lecture we are going to have some sample programs about list control this video is brought to you by Appy Pie’s Academy, okay so I have already created a project called my list and I have created a python program also called list1 dot by it by py it's an empty program so role underscore numbers is going to be the name of my list then within square brackets I am writing 1 0 1 2 0 2 3 0 3 4 0 4 and 5 0 5. so these are one zero one two zero two three zero three four zero four and five zero five these are the elements or we can say items of my list roll underscore numbers so above is the list with the name roll numbers okay so the point to be noted is value at roll underscore numbers in secure brackets I would write 0 is 1 0 1 so the index starts from zero like strings so value at roll numbers within square brackets one is two zero two and so on so always remember index starts from zero now I am going to use print then name of my list roll underscore numbers and within square brackets I am going to write 0 then I am going to write print roll underscore numbers within square brackets I am going to write 1 so as I have explained roll underscore number 0 will print the first element one zero one and roll underscore numbers one will print the second element two zero two so similarly if I happen to write role underscore numbers two it's very clear that third element which is 303 that will be printed y third because index starts from zero so now in order to see the output i'm going to execute the program so i'm going to run the program and you can see the output yes it's one zero one two zero two and three zero three the first three elements are getting printed.

loader
Course content