Question: in python 3 [2.5 pts] In the starter code, there is a function called triangle that calls the function recursive Triangle(n,n) once. For this exercise
in python 3
[2.5 pts] In the starter code, there is a function called triangle that calls the function recursive Triangle(n,n) once. For this exercise you must write the recursive function recursive Triangle(x, n) that returns a string with the LAST x lines of a right triangle of base and height n. - recursive Triangle(x, n) must be a recursive function, otherwise, no credit is given - recursive Triangle(x, n) must return the pattern as ' *** n **n *'. As shown in the example, you can use the print method during testing to check if your pattern is correct. Don't modify anything in the triangle function. If your recursive function is correct, calling triangle(n) should return the complete right triangle. >>> triangle (4) "**** *** ** n >>> print (triangle (4)) This is the output that will be graded, make sure your function returns the value in this form * You can call the print method on your function to see the triangle pattern >>> recursive Triangle (2,4) ' ** *' >>> print (recursive Triangle (2,4)) *** ** >>> triangle (6) "****** ***** **** >>> print (triangle (6) ***** * * * >>> recursiveTriangle (3,6) *** ** >>> print (recursiveTriangle (3,6)) * . * *
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
