Answered step by step
Verified Expert Solution
Question
1 Approved Answer
import math import random import string import collections import datetime import re import time import copy # YOUR CODE BELOW... def writeVertical(n) : # your
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) : # your code here... # end def def main( ) : writeVertical(98312) print(===) writeVertical(0) print(===) writeVertical(-123456789) print(===) digitalSum(1234) print(===) exponents(3, -4) print(===) exponents(16, 0) print(===) exponents(0, 9) print(===) exponents(-18, 7) print(===) exponents(12, 12) invertedImage('*', '#', 6) print(===) invertedImage('@', '^', 18) # end main( ) if __name__ == "__main__" : main( )
Question 2: The digital sum of a number n is the sum of its digits. Write a recursive function called 'digitalSum' that takes a positive integer n and returns its digital sum. For example, digitalSum(1984) will return 22 because 1 + 9 + 8 + 4 = 22 The function prototype MUST be: def digitalSum(n) :
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