I have these two lists:
list1= [1, 3, 8, 14, 20]
list2= [1, 2, 7, 8, 14, 20]
I obtained the common items between these two lists as follow:
commonItems=list(set(list1).intersection(list2))
now randomly picked one of the common items as :
pick=random.sample(commonItems,1)
Now, when I try to identify the picked item index in one of the above lists as :
PickedItemIndex=list1.index(pick)
I got this error: ValueError: [8] is not in list
even if, as you can see, item 8 really exists in list1
what is the problem? I am a new pythonic. Thank you in advance.