Zero Division Error in C2W4 Final Lab

I have encountered an error when doing the practice lab for C2W4, where i have done the first two exercises without any error, but encountered a zero division error at exercise 3. The error is faced when I try to call back a function that i have created in exercise 1.These are my codes and I’m pretty sure len(y) is not 0, how should I solve the problem?

{moderator edit: code removed}

Don’t use ‘m’ inside this function, unless you define it yourself.
As you wrote the code, ‘m’ is a global variable. Don’t use global variables.

Also, please don’t post your code on the forum. That’s not allowed by the Code of Conduct. If a mentor needs to see your code, we’ll contact you with instructions.

Thanks for your advice, and sorry for posting the codes.

No problem.