, если вы смешали пробелы и табуляции, попробуйте запустить ваш скрипт так:
python -tt yourscript.py ##this will raise error if you've mixed spaces and tabs
это то, что я получаю после запуска вашего скрипта, и оно не бесконечно.
At the top of i is 0
Numbers now: [0]
At the bottom i is 1
At the top of i is 1
Numbers now: [0, 1]
At the bottom i is 2
At the top of i is 2
Numbers now: [0, 1, 2]
At the bottom i is 3
At the top of i is 3
Numbers now: [0, 1, 2, 3]
At the bottom i is 4
At the top of i is 4
Numbers now: [0, 1, 2, 3, 4]
At the bottom i is 5
At the top of i is 5
Numbers now: [0, 1, 2, 3, 4, 5]
At the bottom i is 6
At the top of i is 6
Numbers now: [0, 1, 2, 3, 4, 5, 6]
At the bottom i is 7
The numbers:
0
1
2
3
4
5
6