Given a string of words, write the string of words in the opposite order. For example, at the entrance: "Mom washed the frame." Exit: Mom's soap frame. Here is my code, it does not work.

a=[] a=input('Введите фразу:') .split() a.reverse() b=str(a) print(b) 

    1 answer 1

    To join the elements of the array into a string, you can use the join method

     a = input('Введите фразу: ') .split() a.reverse() b = ' '.join(a) print(b)