we thus need to find different way to control the while loop we cannot check whether current has reached headbecause then it will never check the last node but we could use prevsince it lags behind current by one node there is special casehowever the very first loop iterationcurrent and prevwill point to the same nodenamely the tail node we want to ensure that the loop does run heresince we need to take the one node list into consideration the updated delete method now looks as followsdef delete(selfdata)current self tail prev self tail while prev =current or prev !self headif current data =dataif current =self tailself tail current next self head next self tail elseprev next current next self size - return prev current current current next iterating through circular list you do not need to modify the iter(method it will work perfectly well for our circular list but you do need to put in an exit condition when you are iterating through the circular listotherwise your program will get stuck in loop here is way you could do thisby using counter variablewords circularlist(words append('eggs'words append('ham'words append('spam'counter for word in words iter()print(wordcounter + if counter break once we have printed out , elementswe break out of the loop