Six on the Edge

Sometimes it is enough to check only the edges of a list instead of every value inside it. Write a function first_last6 that takes a non-empty list of numbers nums. Return True if the first or last element is 6; otherwise, return False.

Примеры

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

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

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

Теги

listsarray
PostgreSQLv16

Hier erscheint das Ergebnis der Codeausführung

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