no import or input may be used in your solution Do not hardc

no import or input() may be used in your solution. Do not hard-code any values to print other than the space and \"*\" symbols in your solution.

Write a Python function MultiplicationTable0 which takes a positive int value n and produce n by n multiplication table on the screen. The function does not return any value. (See the sample output in the starter code.) must be right justified with column width 5. For this requirement, you must use string formatting covered in the book. You can use for loops or while loops for this problem. Other rules and hints remain the same as above. (starter code and correct output) Your code goes here for i in range 5, 15,5 rint test mt. a output 10 12 15 12 16 20 5 10 15 20 25 6 8 12 14 16 18 20 6 9 12 15 18 21 24 27 30 5 10 15 20 25 30 35 40 45 50 14 21 28 42 49 56 70 10 10 20 30 40 50 60 70 80

Solution

def MultiplicationTable(n):
   for i in range(0,n+1):
       st = str(i)
       ans = st.rjust(5,\' \')
       for j in range(1,n+1):
           st = str(i*j)
           ans = ans + st.rjust(5,\' \')
       print(ans)

def test_mt():
   for i in range(5,15,5):
       MultiplicationTable(i)
       print(\"\")
test_mt()

no import or input() may be used in your solution. Do not hard-code any values to print other than the space and \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site