Switch Places
Swapping values is a small action that appears all the time in sorting, games, and data handling. Given two numbers a and b, return them in the opposite order. The result should contain the old b first, then the old a.
Примеры
Ввод
2, 3Вывод
(3, 2)Ввод
3, 4Вывод
(4, 3)Ввод
67, 12Вывод
(12, 67)Нужно реализовать
def swap(a: int, b: int) -> tuple[int, int]:
Теги
math
Logga in för att se historik över inskick
Logga inLogga in för att använda AI-mentorn
Logga inVisible tests
1
Input
2, 3Expected
[3,2]2
Input
3, 4Expected
[4,3]3
Input
67, 12Expected
[12,67]4
Input
3, -4Expected
[-4,3]5
Input
2, 12Expected
[12,2]6
Input
4, -100Expected
[-100,4]Focus radio
Paused · SomaFM · Fluid