Divisible Count

This kind of check is useful when you need to filter numbers by a simple divisibility rule. Given a list of integers nums and a divisor d, where d is not zero, count how many elements are divisible by d with no remainder. Return that count.

Примеры

Ввод
[1, 2, 3, 4, 5, 6], 2
Вывод
3
Ввод
[1, 2, 3, 4, 5, 6], 3
Вывод
2
Ввод
[], 5
Вывод
0

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

def count_divisible(nums: list[int], d: int) -> int:

Теги

matharray
PostgreSQLv16

Ovdje će se prikazati rezultat izvršavanja koda

Visible tests
1
Input
[1,2,3,4,5,6], 2
Expected3
2
Input
[1,2,3,4,5,6], 3
Expected2
3
Input
[], 5
Expected0
4
Input
[5,10,15], 5
Expected3
5
Input
[1,3,7], 2
Expected0
6
Input
[-4,-2,0,2], 2
Expected4
Focus radio
Paused · SomaFM · Fluid