Three Odds in a Row

Imagine scanning a list of numbers and looking for a short streak of three odd values in a row. Write a function three_consecutive_odds that checks whether such a streak exists in arr. The three odd numbers must be next to each other, with no other elements between them. Return True if the streak exists, otherwise return False.

Примеры

Ввод
[2, 6, 4, 1]
Вывод
False
Ввод
[1, 2, 34, 3, 4, 5, 7, 23, 12]
Вывод
True
Ввод
[1, 3, 5]
Вывод
True

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

def three_consecutive_odds(arr: list[int]) -> bool:

Теги

array
PostgreSQLv16
Entre para enviar

O resultado da execução do código aparecerá aqui

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