The best option to compute the minimum value batween two variables is to use the built-in min() function:
print (min(6,5)) # Output 5
In Python, you can compute the minimum between two variables easily using the built-in min() function.
a = 10
b = 5
result = min(a, b)
print(result)
Output:
5
min(a, b) returns the smaller of the two values.
You can also pass more than two values:
min(3, 8, 1, 9) # returns 1
If you prefer not to use min() (for example, in algorithmic contexts):
result = a if a < b else b