Question: Question 4: Write a Python recursive function called 'invertedImage' that accepts 2 characters 'top' and 'bottom', an integer 'n' representing rows, and an integer 's'

Question 4: Write a Python recursive function called 'invertedImage' that accepts 2 characters 'top' and 'bottom', an integer 'n' representing rows, and an integer 's' representing spaces. This function displays an image of 'n' number of rows of the top character starting with 'n' characters on the first row, n - 1 on the second row, etc. Each row is indented using spaces starting with 's' spaces on the first row and the number of spaces increases by 1 for each subsequent row. After the image using the top character is displayed, another image using the bottom character is displayed starting with 1 character and proceeding to 'n' characters with each row indented using n - 1 spaces, then n - 2, etc. You may assume that the rows will be a positive number greater than 1 and that spaces will always be sent in a value of 0. For example, invertedImage('*', '#', 6, 0) will display: ****** ***** **** *** ** * # ## ### #### ##### ###### For example, invertedImage('?', '8', 4, 0) will display: ???? ??? ?? ? 8 88 888 8888 The function prototype MUST be: def invertedImage(top, bottom, n, s) : 

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!