SoFunction
Updated on 2024-11-12

Python's method of discharging an English statement in reverse order of the words.

For example, "I am a boy" is discharged in reverse order as "boy a am I", all words are separated by a space, and no other characters are included in the statement except for the letters of the alphabet.

list_number = list(input().split(' ')) # Since reverse can not operate on strings, the input string is split by space, and then converted to a list.
list_number.reverse() 
print(" ".join(list_number)) #in order to" "Combine the words in the list into a string by unit

The output is:

boy a am I

Above this python will be an English statement in words in reverse order emission method is all that I share with you, I hope to give you a reference, and I hope you support me more.