Question: Goal: Learn to write recursive functions with a base case. FF . . / home / codegrade / . pyenv / versions / 3 .
Goal: Learn to write recursive functions with a base case. FF
homecodegradepyenvversionslibpythonsite
packagescgfeedbackhelpersimplwriterspy::
cgfeedbackhelpers.impl.writers. FeedbackAssertionError:
homecodegrade pyenvversionslibpythonsite
packagescgfeedbackhelpersimplwriterspy::
cgfeedbackhelpers.impl.writers. FeedbackAssertionError:
failed, passed in
Unit test results:
Test printtree
It should print a tree tall
Reason:
E cgfeedbackhelpers.impl.writers.FeedbackAssertionError:
It should print a tree tall
Reason:
E cgfeedbackhelpers.impl.writers.FeedbackAssertionError:
It should not print anything #
It should not print anything #
Feedback:
Expected value to be instead got
Expected value to be instead got While printtree should print:
You can at most use one other function to achieve this, which should be named printtree.
You have to use recursion to complete this assignment.
Assignment: Write a function printtree that takes an int parameter. This parameter is the
height of the tree to print. The tree's leaves should be asterisks and shaped as a triangle facing
up At the base of the triangle, the tree should have a stem with a height of if the tree is less
than high, and a height of otherwise, represented by the character If the height is not a
positive number, it should print nothing.
For example, printtree should print:While printtree should print:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
