this my code for solving the following exercise about python lists: write a code to verify two list are circularly identical

1 week ago 10
ARTICLE AD BOX

i couldn't explain the circularly identical property by my own words so i am gonna give u this visual explanation:

enter image description here

this is my code:

def extract(e,l): t=[] j=0 for i in l: if i==e: t.append(j) j=j+1 return t def construct(a,l): t=[] for i in range(a,len(l)): t.append(l[i]) for i in range(0,a): t.append(l[i]) return t def verif(l1,l2): test=False if l1[0] in l2: t=extract(l1[0],l2) for i in t: t=construct(i,l2) if t==l1: test=True break return test else: return test
Read Entire Article