Using the function provided, write a function that decides whether two lists are "identical". That is, if cycling by any number N makes the lists identical, the function should return True, otherwise, it should return False. for example identical([1,2,3,4,5], [5,4,1,2,3,]) should give True and identical([1,2,3,4,5], [1,2,3,5,4]) should give False.
Using the function provided, write a function that decides whether two lists are "identical". That is, if cycling by any number N makes the lists identical, the function should return True, otherwise, it should return False.
for example identical([1,2,3,4,5], [5,4,1,2,3,]) should give True and identical([1,2,3,4,5], [1,2,3,5,4]) should give False.
Step 1: Define the function identical() which takes two lists as arguments.
Step 2: Check whether the length of the lists are not equal.
Step 3: If it is true, then return False.
Step 4: Check whether the lists are equal. If the condition is true, then return True.
Step 5: Generate new list by cycling the elements one at a time and check whether it matches the other list.
Step 6: If the condition is true, then return True.
Step 7: After checking all possibilities, if there is no match, then return False.
Step by step
Solved in 4 steps with 2 images