In Python, reversed actually returns a reverse iterator. Thus, list applied to the iterator will provide you with a list object.
In the first case, the input was also a list, so you liked the result of the list applied on the reversed iterator.
In the second case, str applied to the returned iterator object will actually provide you with a string representation.
Instead, you need to iterate over the values ββin the iterator and connect them to str.join , like this
>>> ''.join(reversed('abcde')) edcba
source share