pip install hexlet-graphsfrom hexlet.graphs import build_tree_from_leaf, make_joints, sort_tree
tree = [
"B",
[
["D"],
[
"A",
[
[
"C",
[
["F"],
["E"],
],
],
],
],
],
]
joints = make_joints(tree)
transformed = build_tree_from_leaf(joints, "C")
# ['C', [
# ['F'],
# ['E'],
# ['A', [
# ['B', [
# ['D'],
# ]],
# ]],
# ]]
sort_tree(transformed)
# ['C', [
# ['A', [
# ['B', [
# ['D'],
# ]],
# ]],
# ['E'],
# ['F'],
# ]]This repository is created and maintained by the team and the community of Hexlet, an educational project. Read more about Hexlet.
