{"id":18720,"date":"2021-08-26T10:38:12","date_gmt":"2021-08-26T05:08:12","guid":{"rendered":"https:\/\/python-programs.com\/?p=18720"},"modified":"2021-11-22T18:37:18","modified_gmt":"2021-11-22T13:07:18","slug":"python-program-to-reverse-the-order-of-palindrome-words-in-a-sentence","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-reverse-the-order-of-palindrome-words-in-a-sentence\/","title":{"rendered":"Python Program to Reverse the Order of Palindrome Words in a Sentence"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Sort Palindrome Words in a Sentence<\/a>
\nGiven a string and the task is to reverse the order of all the palindromic words in a given sentence in Python<\/p>\n

Palindrome:<\/strong><\/p>\n

If the reverse of the given string is the same as the given original string, it is said to be a palindrome.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given string\/sentence = 'good bob how are you dod mom'<\/pre>\n

Output:<\/strong><\/p>\n

The given string before reversing the order of paindromic words is =  good bob how are you dod mom\r\nThe given string after reversing the order of paindromic words is =  good mom how are you dod bob<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given string\/sentence = 'hello madam how are yoou mom'<\/pre>\n

Output:<\/strong><\/p>\n

The given string before reversing the order of paindromic words is = hello madam how are yoou mom\r\nThe given string after reversing the order of paindromic words is = hello mom how are yoou madam<\/pre>\n

Program to Reverse the Order of Palindrome Words in a Sentence in Python<\/h2>\n

Below are the ways to reverse the order of all the palindromic words in a given sentence:<\/p>\n