Multiples in Order

This pattern is useful when building a simple sequence, such as a schedule every x minutes, reward levels, or a multiplication table. Write a function count_by that returns a list of n numbers: x, 2x, 3x, and so on up to nx. Start with the first multiple, not with zero.

Примеры

Ввод
1, 5
Вывод
[1, 2, 3, 4, 5]
Ввод
2, 5
Вывод
[2, 4, 6, 8, 10]
Ввод
3, 5
Вывод
[3, 6, 9, 12, 15]

Нужно реализовать

def count_by(x: int, n: int) -> list[int]:

Теги

mathlistsarray
PostgreSQLv16

Aici va apărea rezultatul execuției codului

Visible tests
1
Input
1, 5
Expected[1,2,3,4,5]
2
Input
2, 5
Expected[2,4,6,8,10]
3
Input
3, 5
Expected[3,6,9,12,15]
4
Input
50, 5
Expected[50,100,150,200,250]
5
Input
100, 1
Expected[100]
6
Input
999999, 5
Expected[999999,1999998,2999997,3999996,4999995]
Focus radio
Paused · SomaFM · Fluid