Why I don´t obtain 1<2<3<6<8 in the image code ? I think it has to do with the string format. If I do type for every element in the list the output is str. But then if after the while I do the following it works fine:
second_list = [str(x) for x in (sorted(lista))]
print("<".join(second_list))
I just don´t really understand why the one in the image doesn´t work:

>Solution :
str converts the list into its string representation. Use map to convert each number in the list to str:
lista = [1,2,3,4,9,5]
print("<".join(map(str, sorted(lista))))
>>> 1<2<3<4<5<9