Question: Question text Complete the function print_summary_table() specified in A1.py This function should take as parameters a list of instances of the Tree class, and an
Question text
Complete the function print_summary_table() specified in A1.py
This function should take as parameters a list of instances of the Tree class, and an instance of the Forest class. It should output a table summarising the number of each species of tree in the forest. The trees should be displayed in alphabetical order based on their name. In cases where a tree species is included in the list of trees but there are no versions of that tree in the forest, the tree should still be in the summary table, with a count of 0.
The format of the table should be two columns, the left containing the name and 10 characters wide, the right containing the count and 6 characters wide. Columns should be separated by vertical pipe.
tree_list = load_trees_from_file("Trees.txt") forest = load_forest_from_file("Forest.txt", tree_list) print_summary_table(tree_list, forest) Based on the example file contents given in the introduction section of the assignment handout, the output is:
Species | Count Ash | 2 Oak | 1
You will need to include your Tree and Forest class definitions in your answer. You will not need to include the functions your wrote for parts 3 and 4.
class Forest:
https://www.chegg.com/homework-help/questions-and-answers/write-class-named-forest-represents-set-specific-trees-forest-class-tracks-set-trees-along-q44173162?trackid=UArPISzr
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
