Home / Challenges / Build a Multiplication Table

Build a Multiplication Table

Medium
Write a function multiplication_table(n) that returns an n x n multiplication table as a list of lists, where element [i][j] = (i+1)*(j+1), using a nested list comprehension.

Input

An integer n (table size).

Output

A list of n lists, each containing n integers.

Example

Input
multiplication_table(3)
Output
[[1, 2, 3], [2, 4, 6], [3, 6, 9]]
15 XP on solve Back to lesson

Your Solution

Output
Click "Run" to execute your code...

Log in to submit your solution and earn XP.