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
Prijavite se za ogled zgodovine oddaj
PrijavaPrijavite se za uporabo mentorja UI
PrijavaVisible tests
1
Input
[1,2,3,4,5,6], 2Expected
32
Input
[1,2,3,4,5,6], 3Expected
23
Input
[], 5Expected
04
Input
[5,10,15], 5Expected
35
Input
[1,3,7], 2Expected
06
Input
[-4,-2,0,2], 2Expected
4Focus radio
Paused · SomaFM · Fluid