While loops
while condition: repeats the block as long as the condition is true. Use it
when you don't know the number of steps in advance: halving until you reach
1, reading until input runs out, or moving two pointers toward each other.
Make sure something in the loop moves toward the end. If you forget, the loop runs forever. In this tour you can stop a runaway program, but in an interview it is a red flag, so say out loud what makes your loop finish.
while True: with a break inside is a normal pattern when the exit test
fits best in the middle of the loop.
Python has no do ... while and no i++. Write i += 1.
Run it, then change n to 27 and count the steps.