The use of mean() in rmse(x,y) lecture 1,2

Sorry if this is a stupid question but I tried writing the rmse() function myself in a python REPL and I get an error when I call it:

‘float’ object has no attribute ‘mean’

-------- 8x ---------------
from statistics import mean

a = 33.8
b = 129.8

def rmse(x,y): return math.sqrt(((x-y)**2).mean())

rmse(a,b)

AttributeError: ‘float’ object has no attribute 'mean

-------- 8x ---------------

In the lecture the function works fine. How is mean() being applied to the result of (x-y)**2

if I pass a , b directly to mean() it works fine i,e;

-------- 8x ---------------
mean([a,b]) --> 81.8
mean((a,b)) --> 81.8
-------- 8x ---------------

Nevermind, I get it now, “x” and “y” are numpy arrays. I guess this is why PEP8 is important sometimes :wink: