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
Melde dich an, um den Einreichungsverlauf zu sehen
AnmeldenMelde dich an, um den KI-Mentor zu nutzen
AnmeldenVisible tests
1
Input
1, 5Expected
[1,2,3,4,5]2
Input
2, 5Expected
[2,4,6,8,10]3
Input
3, 5Expected
[3,6,9,12,15]4
Input
50, 5Expected
[50,100,150,200,250]5
Input
100, 1Expected
[100]6
Input
999999, 5Expected
[999999,1999998,2999997,3999996,4999995]Focus radio
Paused · SomaFM · Fluid