easy +5 pts

Multiplication Table Row

Return the row of a multiplication table as a list of products.

Write a function `multiplication_table_row(n)` that takes a positive integer `n` and returns a list of integers representing the row `n` of a standard multiplication table (where rows and columns start at 1). The row should contain `n` elements: `[1*n, 2*n, 3*n, ..., n*n]`. For example, if `n = 3`, the row is `[3, 6, 9]`. Your function should handle any positive integer `n` (1 ≤ n ≤ 1000).

Constraints

1 ≤ n ≤ 1000. The returned list has length n.

Example

>>> multiplication_table_row(3)
[3, 6, 9]
>>> multiplication_table_row(1)
[1]
5 points ~5 min

Recent Submissions

No submissions yet — hit Run Tests to try!

Hints

Use a list comprehension to generate the products.
Remember that each element is `i * n` for `i` from 1 to n.
For n=1, the output is [1].
Python 3
All tests passed!
Test Results
Press Ctrl+Enter or click Run Tests to execute your code.