python/CodeChallenge_10.py

23 lines
578 B
Python

'''
Given two integers x and y, return a list of integers: the first being the minimum of x and y, and the second being the maximum of x and y.
Example 1
Input:
x = 5; y = 3
Output:
[3, 5]
'''
from typing import List
class Solution(object):
def solve(self, x:int, y:int) -> List[int]:
print(f"x: {x}, y: {y}")
result = []
result.append(min(x, y))
result.append(max(x, y))
return result
s = Solution()
print(s.solve(5, 3)) # Output: [3, 5]
print(s.solve(10, 20)) # Output: [10, 20]
print(s.solve(19, -3)) # Output: [-3, 19]