Multiplication Table Rows

Easy ⏱ 8 min 84% acceptance ★★★★★ 4.6
Write times_table(n, upto) returning the first upto multiples of n as a list — and then full_table(n_max, upto) returning a list of such rows for every n from 1 to n_max, both as comprehensions.

Examples

Example 1
Input
full_table(2, 3)
Output
[[1, 2, 3], [2, 4, 6]]
Explanation

Row for 1 and row for 2, three multiples each.

Constraints

  • Implement both functions.
  • full_table must reuse times_table or nest comprehensions.

Topics

List Comprehensionsnested build

Companies

TCSCognizant

Hints

Hint 1

times_table is [n * k for k in range(1, upto + 1)].

Hint 2

full_table wraps it in another comprehension over n.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.