Here's a function that takes the head node of a linked list and returns the range of the values of all its nodes:
main.py489 chars22 lines
This function iterates through each node in the linked list and keeps track of the current minimum and maximum values seen so far. It returns the tuple containing the minimum and maximum values as the range of the linked list.
gistlibby LogSnag