My first thought is obviously that if you copied it back from your forum post then you did edit it to get it to run. That might not be the case though, no point speculating.
I have a few jabs to take at that code. In particular because you say it’s more efficient (what is it doing faster?)
A for-loop would be more suitable because you can iterate over each letter, there’s no need to create an integer to track the position - just ask the string to provide its characters one at a time (that’s what a for-loop does)
for char in text:
len(text) - i > 0
I have to think long and hard about whether that does the right thing, I also have to look further down for
i += 1 which is in two places, is it correct in both cases? Turns out it happens either way (so it shouldn’t be inside an if-statement, put it once outside instead)
Compare to the for-loop which is understandable at a glance.
A for-loop is easier for counting up from zero as well, because you can create a range and iterate through that.
You have a while-else. That’s probably not what you meant - take great care that each thing in your code is necessary, because if it’s not, then what could it possibly be doing? In this case it doesn’t do anything at all (so it shouldn’t be there). To run code after a loop, put that code below the loop.
word = word + text[i]
This (the + operator) says to copy the whole current word.
If you do this 50 times, then on average the word is 25 characters, meaning 25 characters are copied 50 times, that’s 1250 copied characters. You wouldn’t do that many steps manually, this isn’t efficient!
What you would do instead is use a data structure that does support appending (list for example), and then create a string from that.