Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE DO IT RECURSIVELY using python For this part of the homework you will wri

ID: 3717908 • Letter: P

Question

PLEASE DO IT RECURSIVELY using python

For this part of the homework you will write code to draw an isosceles right triangle. (A right triangle in which the height and base are the same size.)

Your program should prompt the user for these inputs, in exactly this order: 1. The height of their triangle 2. The symbol the triangle will be outlined in 3. The symbol the triangle will be filled with For these inputs, you can assume the following: ?

The height will be a positive integer (greater than zero) ? The symbols will be a single character each Use the first symbol to draw an isosceles right triangle of the height chosen by the user. The triangle should be filled in with the second symbol, in the cases in which there is interior space to fill. The program must contain a main() and a recursive function calledrecurTri(). The program may also contain any other functions you deem necessary.

Explanation / Answer

Please Note -- Use Python 3

def drawtri(n,target,out,fill):
for i in range(0,n-1):
if n<2 or i==0 or i==n-1 or n==target:
print (out, end='')
else:
print (fill, end='')
print (out)
n=n+1
if n<=target:
drawtri(n,target,out,fill)

ht = input('Enter height')
out = input("Enter Outline char")
fill = input("Enter Fill char")
drawtri(1,int(ht),out,fill)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote