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
PostgreSQLv16

Her vises resultatet af din kode

Visible tests
1
Input
[1,2,9]
Expected1
2
Input
[1,9,9]
Expected2
3
Input
[1,9,9,3,9]
Expected3
4
Input
[]
Expected0
5
Input
[8,8,8]
Expected0
6
Input
[1]
Expected0
Focus radio
Paused · SomaFM · Fluid