On Thu, Feb 26, 2015 at 08:55:55AM +0000, Alan Gauld wrote: > However remove() may not do what you think. It removes the > value zero from your list not the first element. I this case they are > the same but in other cases they might not be. You may want to use del() > instead > > del(unvisited_caves[0])
del is not a function, it is a statement, so it doesn't need the brackets (parentheses for any Americans reading). del unvisited_caves[0] Although the parens don't do any harm. To be clear, `del somelist[x]` deletes the xth item from somelist. But `somelist.remove(x)` deletes the first item that equals x, equivalent to this Python code: for i in range(len(somelist)): if somelist[i] == x: del somelist[i] break -- Steve _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor