Ones and Fours Balance

Sometimes you need to compare how many times two different values appear in a list. Write a function more_14 that takes a list nums and counts the number of 1 values and 4 values. Return True if the counts are equal, otherwise return False.

Примеры

Ввод
[1, 4, 1, 4]
Вывод
True
Ввод
[1, 1, 4]
Вывод
False
Ввод
[1, 4, 1]
Вывод
False

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

def more_14(nums: list[int]) -> bool:

Теги

listsarray
PostgreSQLv16

Her vises resultatet af din kode

Visible tests
1
Input
[1,4,1,4]
ExpectedTrue
2
Input
[1,1,4]
ExpectedFalse
3
Input
[1,4,1]
ExpectedFalse
4
Input
[]
ExpectedTrue
5
Input
[4,4,1,1]
ExpectedTrue
6
Input
[2,5,2,5]
ExpectedTrue
Focus radio
Paused · SomaFM · Fluid