Short
“Moving” is pretty simple:
Remove the item from list 1
Add it to list 2
listToMoveFrom.remove("stuff")
listToMoveTo.append("stuff")
Is that what you need?
Details
Here is it at high level (no error handling yet):
def move(lists, item):
sourceList = findListContainingItem(lists, item)
destinationList= findNextList(lists, sourceList)
moveItem(sourceList, destinationList, item)
You would need to search all lists to see where the item is:
def findListContainingItem(lists, itemToLookFor):
for subList in lists:
if itemToLookFor in subList:
return subList
Then find the next list:
def findNextList(lists, list):
'Error when the list is the last list'
index = lists.index(list)
return lists[index+1]
And the move as mentioned above, but separated into an own function:
def moveItem(sourceList, destinationList, itemToMove):
sourceList.remove(itemToMove)
destinationList.append(itemToMove)
Demo
All together a runnable demo:
def demonstrateMove():
lists = [[] for a in range(10)]
lists[0].append("stuff")
print(lists)
for a in range(10):
move(lists, "stuff")
print(lists)
demonstrateMove()
def move(lists, item):
sourceList = findListContainingItem(lists, item)
destinationList= findNextList(lists, sourceList)
moveItem(sourceList, destinationList, item)
def findListContainingItem(lists, itemToLookFor):
for subList in lists:
if itemToLookFor in subList:
return subList
def findNextList(lists, previousList):
'Error when the list is the last list'
index = lists.index(previousList)
return lists[index+1]
def moveItem(sourceList, destinationList, itemToMove):
sourceList.remove(itemToMove)
destinationList.append(itemToMove)
Remark: This code is not efficient. It should be fine when the list size is just few items (<100). On larger lists you need to think about more efficient data structures.