The function will take the dictionary as input, and I want to find the length of the longest path in the dictionary. In principle, if in the dictionary key2 corresponds to value 1, and key3 corresponds to value2, etc., this is considered as a path. For instance:
{'a':'b', 'b':'c', 'c':'d'}
In the above case, the length should be three. How can i achieve this? Or more specifically, how can I compare keys with values? (it can be any lines, numbers, etc., and not just numbers)
Thank you very much in advance!
source share