Fill With the Larger End

Sometimes the answer depends only on the edge values of a list, while the middle does not matter. Write a function max_end3 that takes a list nums with exactly 3 numbers. Compare the first and last elements, choose the larger one, and return a list of 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
PostgreSQLv16

Här visas resultatet av din kod

Visible 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
[0,0,0]
Expected[0,0,0]
6
Input
[11,9,5]
Expected[11,11,11]
Focus radio
Paused · SomaFM · Fluid