// input = "my name is user name"
// output = "name user is name my"
statment = "my name is user name"
def reverseStatement(st):
word_indx = 0
reverse_st = ""
for i, char in enumerate(st):
if char.isspace() or i == len(st) -1:
word_end = i if i == len(st) -1 else i -1
word = st[word_indx: word_end+1]
reverse_st = word + " " + revervse_st
word_indx = i + 1
return reverse_st
How to Find Reverse a String in Python ? #shorts
Reverse words of a given string in python Part 17 | Python programming #python #shorts
Program in Python to Reverse the Alternate words in a String | CBSE Computer Science
Python Program To Reverse Alternate Words In A String