Cargando el ejercicio…
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]Falsedef first_last6(nums: list[int]) -> bool:
Inicia sesión para ver tu historial de envíos
Iniciar sesiónInicia sesión para usar el AI Mentor
Iniciar sesión[1,2,6]True[6,1,2,3]True[13,6,1,2,3]False[6]True[5]False[0,0,0]False