Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

goal: Learn to write recursive functions with a base case. ( python ) Assignment: Write a function print _ tree that takes an int parameter.

goal: Learn to write recursive functions with a base case. (python)
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.
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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions