Q:

python two variables - find which one is closest to zero

I have two variables  - Value1 and Value2 that are set using previous functions in my code.
I want to select and output the variable that is closest to zero.
The variables change every time I run my code so can be decimal or integer format and positive/negative values.
I have seen examples of using lambda and numpy but I'm new to python so I'm unsure how to implement these correctly.  Examples I have seen have the values in an array or list but mine are two separate variables.

A:

You can choose the one with the smallest absolute value:
a = -4
b = 3

min(a, b, key=abs)

# 3

