import numpy as np

def get_lerp_factor(a, x, b):
    a, x, b = np.asarray(a), np.asarray(x), np.asarray(b)
return ((x - a) / (b - a)).clip(0, 1)
How to code a Python function that accepts float, list or numpy.array?