I'm trying to implement a simple recursive calculation in Python that uses the reduce() function however I get an error message: “Runtime Error: NameError : name 'reduce' is not defined”.  

I can't import functools module either because I get an error.

The specific code I need is:

#Lineal Deviation Calculation
reduce(lambda a,b:a+abs(avg-b),list,0)/len(list)

where avg=sum(list)/len(list)

Thanks for any help,