I currently have a populated list full of nodes in a path from one node to another. I need to stylize the printing of the path as such:
node -> node -> node -> node -> node -> node I currently have this code to do so:
if len(path) %4 == 0: for i in range(0, len(path)): if i+1 % 4 == 0: print(print_queue[0]+' -> '+print_queue[1]+' -> '+print_queue[2]+' -> '+print_queue[3]+' -> ') print_queue = [] else: print_queue.append(path[i]) if len(path) %4 == 1: path.append(' ') for i in range(0, len(path)): if path[i] == ' ': break if i+1 % 4 == 0: print(print_queue[0]+' -> '+print_queue[1]+' -> '+print_queue[2]+' -> '+print_queue[3]+' -> ') print_queue = [] else: print_queue.append(path[i]) if len(path) %4 == 2: path.append(' ') for i in range(0, len(path)): if path[i] == ' ': break if i+1 % 4 == 0: print(print_queue[0]+' -> '+print_queue[1]+' -> '+print_queue[2]+' -> '+print_queue[3]+' -> ') print_queue = [] else: print_queue.append(path[i]) if len(path) %4 == 3: path.append(' ') for i in range(0, len(path)): if path[i] == ' ': break if i+1 % 4 == 0: print(print_queue[0]+' -> '+print_queue[1]+' -> '+print_queue[2]+' -> '+print_queue[3]+' -> ') print_queue = [] else: print_queue.append(path[i]) if print_queue != []: if len(print_queue) == 1: print(print_queue[0]) if len(print_queue) == 2: print(print_queue[0]+' -> '+print_queue[1]) if len(print_queue) == 3: print(print_queue[0]+' -> '+print_queue[1]+' -> '+print_queue[2]) But the path is not being printed. The path list is populated, but the program does not give any output.
What do I need to change in order for this path to print?