I wrote the function to find list A is in List B, the code as below:
def isinlist(l1,l2):
flag=1
for i in range(0,len(l1)+1):
if l1[i] not in l2:
flag = 0
return flag
a1 = ['hello','hi','123']
a2 = ['no worry','hello','hi','123'' ]# f1 = isinlist()
print(isinlist(a1,a2))
it show the error as below
IndexError: list index out of range
I thought the error come from l1 and l2 wasn't defined range in the function? Can someone help advise on this ?