def CountingVallys(PathsTaken): #Converts the Strings U and D into 1 and -1 respectively Separate_Paths = [i for i in PathsTaken] for index, i in enumerate(