Fill From the Edge
Sometimes the answer depends only on the edge values of a list, not on everything inside it. Write a function max_end3 that takes a list nums with exactly three numbers. Find the larger value between the first and last elements, then return a new list containing three copies of that value.
Примеры
Ввод
[1, 2, 3]Вывод
[3, 3, 3]Ввод
[11, 5, 9]Вывод
[11, 11, 11]Ввод
[2, 11, 3]Вывод
[3, 3, 3]Нужно реализовать
def max_end3(nums: list[int]) -> list[int]:
Теги
listsarray
Prijavite se za ogled zgodovine oddaj
PrijavaPrijavite se za uporabo mentorja UI
PrijavaVisible tests
1
Input
[1,2,3]Expected
[3,3,3]2
Input
[11,5,9]Expected
[11,11,11]3
Input
[2,11,3]Expected
[3,3,3]4
Input
[5,2,5]Expected
[5,5,5]5
Input
[3,2,1]Expected
[3,3,3]6
Input
[0,0,0]Expected
[0,0,0]Focus radio
Paused · SomaFM · Fluid