Chosen Solution

So it randomly switched off and won’t turn on. I tried various methods like plugging it in and pressing the home button and vo down button. The battery was around 40%. UPDATE:- My battery is flawless, this thing happened for the 1st time

Most likely a faulty battery.

@imaadvx any iPhone is likely to suddenly comatose. Moreover older models which have become slow from updating to the latest (installable) iOS version and/or those with full memory and/or those with failing batteries. The first easy fix that you must try is hard rebooting by pressing and holding the power button + home button (power button + volume down button for iPhones 7/7+) until the phone restarts. Charging it if you feel the battery was drained, then trying to reboot again. Or if you feel comfortable tinkering with your iDevice and have experience with it, you can disconnect the battery, press and hold the power button for a few seconds, reconnect the battery and try again to boot. Letting your battery drain has the same “reset effect” which is why it eventually woke up.

Actually it is back. I left it for a day or 2 and the battery trained completely. I plugged it in and it came back.