Python is case-sensitive, so make sure the uppercase and lowercase are accurate.
In case you’re not able to resolve it, please share the part of the code, where you defined ‘factor’.
In the function definition compute_bounds(), you have passed the parameter as ‘factory’ and later on you are using ‘factor’ (Zn= factor * math.sqrt(Variance / frame_size)) which is not defined.
You need to change either the parameter name to ‘factor’ or use the same name(factory) in the line (Zn= factory * math.sqrt(Variance / frame_size)).