No Indexing of elements

No Indexing of elements

Lesson Details:
September 17, 2020

Video Transcription: In this very brief lecture I am going to show you that a set is an unordered list of elements what does it mean is this video is brought to you by Appy Pie’s Academy, we cannot access the individual elements through the indexing system so as a set s in an unordered list of elements there is no concept of indexing in it hence individual elements cannot be accessed let's prove this with the help of an example suppose I have got this set and its containing some values to L 23 etc so suppose what I want to do is I want to access the very first element and in order to do it because the name of the set is all but I am going to write as print all within square brackets 0 it is definitely going to result into an error message so let's prove it what I can do is I will press the right mouse button on the program itself in order to execute it then I will go to run this is run check 3 is the name of the program and now we will see the error message yes as you can see the message is very clear set object does not support indexing that is why this is invalid to access an individual element of a set using indexing technique so that means this is also invalid print suppose like in previous cases we were doing suppose I am writing 1 colon 3 so what does that mean it means I want to access or arrange all the elements starting from the index number 1 till index number 2 because the last number is whatever last number is mentioned that is minus 1 but this is feasible only in case of tuples and lists we cannot do it in case of a set right so I think this will cause error okay so this is going to cause an error let's again try it press the right mouse button on the program click on run set three is the name of the program and again the same messages appearing set object does not support indexing so what we have learnt is set is an unordered list of elements we cannot use indexing to access individual elements.

loader
Course content