Question: MAIN PROGRAM: import math import random import string import collections import datetime import re import time import copy # YOUR CODE BELOW... def writeVertical(n) :
MAIN PROGRAM:
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( )
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.
The OUTPUT should be EXACTLY as displayed below:
****** ***** **** *** ** * # ## ### #### ##### ###### === @@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@ @@@@@@@@@@@@@@ @@@@@@@@@@@@@ @@@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@ @@@@@@@@@ @@@@@@@@ @@@@@@@ @@@@@@ @@@@@ @@@@ @@@ @@ @ ^ ^^ ^^^ ^^^^ ^^^^^ ^^^^^^ ^^^^^^^ ^^^^^^^^ ^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
# please do the 4th function
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
