Problem with compound interest problem

I am trying to submit answer for this compound interest problem but the error of edge cases is coming here. The screen shot is attached for reference. Pl suggest the modifications required.

Hi Shilpa,

Please try to restart the kernel and rerun if your code seems fine and you are getting the desired result. Lots of code in a single notebook sometimes causes issues.

If the problem still persists with the assessment engine, try logging in from My Labs > Jupyter which opens jupyter in browser. The assessment will work from there too.

If the issue is still there, try logging in Cloudxlab in incognito mode and see if it works.

Regards.

Hi, Shilpa.

I appreciate your efforts!

Kindly look at the following changes.

  1.     if principle != 0:   ----->  This is a redundant step that you have written, this means principle can be positive or negative but not zero., as you already written principle>0, which means taking positive values so not required.
    
  2. You are storing the compound interest value in a wrong variable called “comp_interest”, as per the instructions you need to “return(compound_interest)”.

  3. You need return 0 if any of the principle, rate, years will become zero. (This is the edge case).
    else:
    return(0).

Now you should be able to do it.

All the best!

Thank you. The code is working fine and submitted.

1 Like