Double Two

Sometimes you need to notice not just a value in a list, but the same value appearing twice in a row. Write a function has22 that takes a list nums and checks whether it contains two neighboring 2 values. Return True if such a pair is found, otherwise return False.

Примеры

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

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

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

Теги

listsarray
PostgreSQLv16

Hawn jidher ir-riżultat tat-tħaddim tal-kodiċi

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