The first code piece input[0]
is required. If it is an empty string it will not work.
This is just to be defensive (of course your probably need to check None or other types as well to be even more defensive)
One of the difference I have is a treat the first element no different from the rest. And I've made function and assert (tests) to verify them. If I see this in the exam, I know this is a experienced engineer who has a good sense how to test rather than relying on stardard output.