MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / in_reverse

Function in_reverse

data_structures/linked_list/print_reverse.py:110–117  ·  view source on GitHub ↗

Prints the elements of the given Linked List in reverse order >>> in_reverse(LinkedList()) '' >>> in_reverse(make_linked_list([69, 88, 73])) '73 <- 88 <- 69'

(linked_list: LinkedList)

Source from the content-addressed store, hash-verified

108
109
110def in_reverse(linked_list: LinkedList) -> str:
111 """Prints the elements of the given Linked List in reverse order
112 >>> in_reverse(LinkedList())
113 ''
114 >>> in_reverse(make_linked_list([69, 88, 73]))
115 '73 <- 88 <- 69'
116 """
117 return " <- ".join(str(line) for line in reversed(tuple(linked_list)))
118
119
120if __name__ == "__main__":

Callers 1

print_reverse.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected