id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

multiplicationTable


Write a function that takes an integer n as a parameter, and computes an n × n multiplication table as a list of lists called H. The value in row r and column c should be the product of r and c. Recall that we always start counting at zero, so when n=2 the rows will be labeled 0 and 1 and the columns will be labeled 0 and 1. For example, when n = 6 you return

[[0,0,0,0,0,0],
[0,1,2,3,4,5],
[0,2,4,6,8,10],
[0,3,6,9,12,15],
[0,4,8,12,16,20],
[0,5,10,15,20,25]]

multiplicationTable(2) → [[0, 0], [0, 1]]
multiplicationTable(3) → [[0, 0, 0], [0, 1, 2], [0, 2, 4]]
multiplicationTable(4) → [[0, 0, 0, 0], [0, 1, 2, 3], [0, 2, 4, 6], [0, 3, 6, 9]]

...Save, Compile, Run (ctrl-enter)

def multiplicationTable(n):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Copyright Nick Parlante 2017 - privacy