What is an index?

so index means the elements in the list, right?
Also, didnt seem to quite grasp the output. Explanation needed.

that is not what index/indices means.

the elements of a list are just called elements or values.

The index(es)/indices of a list is the position of an element/value in the list

what really confuses me is : “for index in range(len(lst1)):
if lst1[index] == lst2[index]:” so in the first line “index” represents that it would iterate through every element in lst1, that’s fine. But how can it iterate through the lst2 when there was no distinct declaration like: “for i in the range(len(lst2)):” sometimes you need to have two variables called for 2 lists, for example the exponent challenge exercise, we had to call 2 variables to work that out, but in this case my code:
def same_values(lst1,lst2):
for i in range(0,(len(lst1))):
for j in range(0,(len(lst2))):
if lst1[i]==lst2[j]:
didnt work because i didn’t call for the same variable. now i’m confused how to understand this iteration behavior of python. can anyone kindly tell me what’s it, that i’m doing wrong???

You need to do something like this. You don’t have loop before the if statement. Hence, only one value will return. And obvisouly lst1 and lst1 are already defined; you don’t need to create the for cause for the loop to get the list. In sum, first, check the index in each list. second, seek if the value are met by check list [index]. Third, if match, append them into a new list

def same_values(lst1, lst2):
index =

for i in range (len(lst1)):

for i in range (len(lst2)):

for i in range (len(lst2)):
if lst1[i] == lst2[i]:
index.append (i)
return index

When using “range(len(lst1))” it will give an index range for the length of the first list. These numbers are not using the values in that particular index for that list. This means that by having this number set you can compare both lists with the index number, further finding values at that given index. Having another list length would be considered inefficient, as this is a comparison of values with the same indexes.

If you still don’t quite understand what I mean I will supply my code with annotations