human
Reverse String according to the number of words | Reverse the letters of the word.
Temporary variable to store character.
Swapping the first and last character.
This function forms the required string.
Checking the number of words present in string to reverse.
Reverse the letter of the words.
Driver Code"
How can the above be solved in Python?

Can you provide a code to reverse String according to the number of words and the other steps required?
assistant
#Here is code to reverse String according to the number of words and the other steps required.
 def reverse ( string , start , end ) :
	temp = ' '
	while start <= end :
		temp = string [ start ]
		string [ start ] = string [ end ]
		string [ end ] = temp
		start += 1
		end -= 1
def reverseletter ( string , start , end ) :
	wstart , wend = start , start
	while wend < end :
		if string [ wend ] == " ▁ " :
			wend += 1
			continue
		while wend <= end and string [ wend ] != " ▁ " :
			wend += 1
		wend -= 1
		reverse ( string , wstart , wend )
		wend += 1
if __name__ == " _ _ main _ _ " :
	string = " Ashish ▁ Yadav ▁ Abhishek ▁ Rajput ▁ Sunil ▁ Pundir "
	string = list ( string )
	reverseletter ( string , 0 , len ( string ) - 1 )
	print ( ' ' . join ( string ) )