Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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.
using the main below:
import math import random import string import collections import datetime import re import time import copy # YOUR CODE BELOW... def writeVertical(n) : # your code here... # end def def digitalSum(n) : # your code here... # end def def exponents(a, b) : # your code here... # end def def invertedImage(top, bottom, n, s) : # your code here... # end def def main( ) : writeVertical(98312) print("===") writeVertical(0) print("===") writeVertical(-123456789) print("===") print(digitalSum(1234)) print("===") print(exponents(3, -4)) print("===") print(exponents(16, 0)) print("===") print(exponents(0, 9)) print("===") print(exponents(-18, 7)) print("===") print(exponents(12, 12)) print("===") invertedImage('*', '#', 6, 0) print("===") invertedImage('@', '^', 18, 0) # end main( ) if __name__ == "__main__" : main( )
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