Find One Two Three

In lists, you often search for a whole pattern, not just one value, such as a sequence of actions or a code combination. Write a function array123 that takes a list of numbers nums and returns True if the numbers 1, 2, and 3 appear next to each other in that exact order. If no such triple exists, return False.

Примеры

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

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

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

Теги

listsarray
PostgreSQLv16
Entre para enviar

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

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