Where have I gone wrong in this solution

Can you help me with the debugging here

Got the answer, it happened because I was printing None instead of No Majority Elements. My bad, I should have read the question properly.