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

Method __str__

data_structures/binary_tree/is_sum_tree.py:89–96  ·  view source on GitHub ↗

Returns a string representation of the inorder traversal of the binary tree. >>> str(list(BinaryTree.build_a_tree())) '[1, 2, 7, 11, 15, 29, 35, 40]'

(self)

Source from the content-addressed store, hash-verified

87 return len(self.root)
88
89 def __str__(self) -> str:
90 """
91 Returns a string representation of the inorder traversal of the binary tree.
92
93 >>> str(list(BinaryTree.build_a_tree()))
94 '[1, 2, 7, 11, 15, 29, 35, 40]'
95 """
96 return str(list(self))
97
98 @property
99 def is_sum_tree(self) -> bool:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected