Let's say I have 2 lists:
a = [6,7,8,9,10]
b = [1,3,4,6,7,8,9,10]
I have a function that is used to find out if list a can be found in list b. If it is found, then it returns True. In my case it should return True because list a can be found at the end of list b. List a never changes and always contains the same numbers, whereas list b accepts numbers from the user and then uses sorted() method to sort numbers in ascending order. I should also add that the order does matter.
I have searched around and could find a subset method, which looks like this: set(a).issubset(set(b))) as well as using in method. Both of them did not work for me.
UPDATE: Using set(a).issubset(set(b))) for some reason always returns True. For example, if a = [1,1] and b = [0,1,2,3,4,5] then using subset method returns True, even though 1,1 cannot be found in b. I'm not looking if 1 is inside the list, I'm looking if 1,1 is inside the list.
Using in method when
a = [6,7,8,9,10]
b = [1,3,4,6,7,8,9,10] returns False.
a = set([1,1])only has the element1, in it, and1is in[0,1,2,3,4,5]inmethod whena = [6,7,8,9,10]andb = [1,3,4,6,7,8,9,10]returns False" doesn't explain how you actually implemented this. Maybe you have a syntax problem that we can help you resolve that you are unaware of.