Basic calculator with a little bit doubt

I passed all the test cases with my code below


but I failed with the code below (another one)

Could you guys mention my mistake please?