Error: could not JSON serialize output

I have submitted my assignment several times and getting the same error every time. My answer is correct (as I have compared my answers with others), But, due to this error: ‘couldn’t JSON serialize output’, I’m failing to pass the assignment. Please help.

Please mention the assignment topic, the notebook link.