Assignment 1 autograding errors

Hello,
can someone look into this errors. when i run the code in replit it works fine as expected…But in autograding it is showing error…any help would be appreciated

error snapshot:

It looks like a part of your code is coming up as “undefined” when it should be coming up as “40”. Does your grading process work when you run the program?

Thanks for responding…
Finally I am able to fix them with few suggestions from the fellow students. My code is working fine now.