Highest and Lowest
When numbers arrive as one string, you first need to parse them before you can compare them. Write high_and_low, which receives numbers, a string of space-separated integers. Return a string containing the largest number first, then a space, then the smallest number.
Примеры
Ввод
"1 2 3 4 5"Вывод
"5 1"Ввод
"1 2 -3 4 5"Вывод
"5 -3"Ввод
"1 9 3 4 -5"Вывод
"9 -5"Нужно реализовать
def high_and_low(numbers: str) -> str:
Теги
stringsmath
Conectează-te pentru a vedea istoricul soluțiilor trimise
Conectează-teConectează-te pentru a folosi Mentorul AI
Conectează-teVisible tests
1
Input
"1 2 3 4 5"Expected
"5 1"2
Input
"1 2 -3 4 5"Expected
"5 -3"3
Input
"1 9 3 4 -5"Expected
"9 -5"4
Input
"42"Expected
"42 42"5
Input
"-1 -2 -3"Expected
"-1 -3"6
Input
"5 4 3 2 1"Expected
"5 1"Focus radio
Paused · SomaFM · Fluid