App Academy

Does algorithm that works in ruby will not work in python

solution of 05_compress_str from algorithmic strategies exercise works fine in ruby but when I try to write the same algorithm in python it gives me index out of bound error why does this happen
below is the implementation in both ruby and python


I have to check for “i” in the inner while loop as well to make it run correctly why is the case that in ruby we don’t have to check for “i” in the inner loop and it works okay
please help me clear this doubt.