clamp number in python

def clamp(num, min, max):
    if num > max:
        return max
    elif num < min:
        return min
    else:
        return num

Here is what the above code is Doing:
1. It's creating a function called clamp.
2. It's taking three arguments: num, min, and max.
3. It's checking if num is greater than max. If it is, it returns max.
4. If num is not greater than max, it checks if num is less than min. If it is, it returns min.
5. If num is not less than min, it returns num.