circular-list

Finding whether 2 indices are adjacent in circular list

Finding whether 2 indices are adjacent in circular list Question: Say I have a circular list which would look like this to a human: How can I determine whether two indices are adjacent please? So far I have: def is_next_to(a, b): if a == b: return False return abs(a – b) == 1 assert is_next_to(1, …

Total answers: 1