Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a class named Tree which represents a tree species. This class tracks several properties associated with drawing the tree: its name, how long each
Write a class named Tree which represents a tree species. This class tracks several properties associated with drawing the tree: its name, how long each branch section is, the colour of the branches, the colour of the leaves, and the angle at which branches diverge. You must complete the following functions in the Tree class: _init_o The init function should take as parameters all of the properties of the Tree defined in the file. Note that Python Turtle requires colours to be passed as a tuple of three values (r,g,b). __str_0 Consider the following code fragment: my_tree = Tree("Ash, 4, (150, 75,0), (0,255,0), 30) print(my_tree) The output should be: Ash __repr_0 Consider the following code fragment: C = Tree("Ash", 10, (5, 5, 5), (10, 10, 10), 30) print(repr(c)) The output should be: Tree("Ash", 10, (5, 5, 5), (10, 10, 10), 30)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started