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..
/home/codegrade/.pyenv/versions/3.11.9/lib/python3.11/site-
packages/cg_feedback_helpers/_impl/writers.py:170:
cg_feedback_helpers._impl.writers. FeedbackAssertionError: 1
/home/codegrade/. pyenv/versions/3.11.9/lib/python3.11/site-
packages/cg_feedback_helpers/_impl/writers.py:170:
cg_feedback_helpers._impl.writers. FeedbackAssertionError: 1
2 failed, 2 passed in 0.04s
Unit test results:
Test print_tree
ox It should print a tree 8 tall
Reason:
E cg_feedback_helpers._impl.writers.FeedbackAssertionError: 1
It should print a tree 15 tall
Reason:
E cg_feedback_helpers._impl.writers.FeedbackAssertionError: 1
It should not print anything #1
It should not print anything #1
Feedback:
Expected value to be *, instead got *
Expected value to be *, instead got * While print_tree(11) should print:**]
]You can at most use one other function to achieve this, which should be named _print_tree.
You have to use recursion to complete this assignment.
Assignment: Write a function print_tree 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 1 if the tree is less
than 10 high, and a height of 2 otherwise, represented by the character "]". If the height is not a
positive number, it should print nothing.
For example, print_tree(5) should print:**]While print_tree(11) should print:
**
 Goal: Learn to write recursive functions with a base case. FF..

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!