improving list traversal if you notice how we traverse our list that one place where we are still exposed to the node class we need to use node data to get the contents of the node and node next to get the next node but we mentioned earlier that client code should never need to interact with node objects we can achieve this by creating method that returns generator it looks as followsdef iter(self)current self tail while currentval current data current current next yield val now list traversal is much simpler and looks lot better as well we can completely ignore the fact that there is anything called node outside of the listfor word in words iter()print(wordnotice that since the iter(method yields the data member of the nodeour client code doesn' need to worry about that at all deleting nodes another common operation that you would need to be able to do on list is to delete nodes this may seem simplebut we' first have to decide how to select node for deletion is it going to be by an index number or by the data the node containshere we will choose to delete node by the data it contains