Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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