Nine Counter
Counting one specific value in a list is a basic technique for statistics and simple checks. Write a function count_9 that takes a list nums and counts how many times the number 9 appears in it. Return that count as an integer.
Примеры
Ввод
[1, 2, 9]Вывод
1Ввод
[1, 9, 9]Вывод
2Ввод
[1, 9, 9, 3, 9]Вывод
3Нужно реализовать
def count_9(nums: list[int]) -> int:
Теги
listsarray
Log in om je inzendingsgeschiedenis te zien
InloggenLog in om de AI-mentor te gebruiken
InloggenVisible tests
1
Input
[1,2,9]Expected
12
Input
[1,9,9]Expected
23
Input
[1,9,9,3,9]Expected
34
Input
[]Expected
05
Input
[8,8,8]Expected
06
Input
[1]Expected
0Focus radio
Paused · SomaFM · Fluid