Write a Python lambda function that returns the minimum of two numbers. The function should accept two numbers and return the smaller one.
Example 1:
Input: 5, 10
Output: 5
Example 2:
Input: -7, -3
Output: -7
You can use Python’s built-in min function or a conditional expression to get the smaller number.
# Define the lambda function
min_two_numbers = lambda x, y: x if x < y else y
# Test the function
print(min_two_numbers(5, 10)) # Output: 5
print(min_two_numbers(-7, -3)) # Output: -7
NOTEOwing to browser caching, any code input into the Trinket IDE might carry over across page refreshes or when transitioning between different questions. To commence with a clean slate, either click on the 'Reset Button' found within the IDE's Hamburger icon (☰) menu or resort to using Chrome's Incognito Mode.