If you were an electric motor with sufficient torque and still cared about such things, you would prefer the cycle, but as the slope grows steeper, your human leg motion slows down, effectively approaching the point where you are keeping your legs almost still (and struggling to keep your balance). Holding your legs still under resistance achieves no effective work, but does use up muscular energy. Therefore you need to change gears as the slope grows steeper. This permits you to keep peddling quickly enough to avoid wasting energy against unproductive resistance.
However, you still need to exert more energy for each metre you travel, the steeper the slope becomes, so walking has its attractions.
So does turning round and coasting.
So does driving...
Happy peddling,
Jon