Write a function to reverse words of string


Topic: Write a function to reverse words of string

Solution

def rev_sentence(sentence):  
  
    words = sentence.split(' ')  
  
    reverse_sentence = ' '.join(reversed(words))  
  
    return reverse_sentence 



List all Python Programs