Should I Upgrade my CPU from i5 2.3 Ghz to 2.7 GHz i7 ?

I'll be using Macbook mostly for coding, light gaming like pubg, fortnite, and watching movies.
If you can afford it. But I would recommend upgrading the RAM first (if you haven’t already). Generally that tends to provide the most notable performance boost.

The i5 is already a quad-core, so it is more than enough for what you’re planning on using it for.

Hope that helps!
Since you reference the i5, that's means you're getting a 13" MBP. Those games are not going to run very well with the integrated gpu, the CPU upgrade will not impact performance that much.
Does it HAVE to be a Mac? There are some good gaming laptops from Dell (Alienware), Asus (ROG), MSI, and Razer.

Original thread: https://forums.imore.com/threads/should-i-upgrade-my-cpu-from-i5-2-3-ghz-to-2-7-ghz-i7.405059/