Problem 180575 · easy · Phase 01 Prerequisites & Setup

One Row of the Multiplication Table

loops · range · lists

Write table_row(n, k) that returns the list [n*1, n*2, ..., n*k], i.e. one row of the multiplication table. When k is 0 return an empty list.

Examples

Input:  n = 7, k = 5
Output: [7, 14, 21, 28, 35]

Input:  n = 3, k = 0
Output: []

Constraints

  • -1000 <= n <= 1000
  • 0 <= k <= 10**4

Goals

  • Use range() with a start of 1
  • Build a list of computed values
Starting Python…