{"id":17604,"date":"2021-08-17T20:25:17","date_gmt":"2021-08-17T14:55:17","guid":{"rendered":"https:\/\/python-programs.com\/?p=17604"},"modified":"2021-11-22T18:37:21","modified_gmt":"2021-11-22T13:07:21","slug":"__trashed-2","status":"publish","type":"post","link":"https:\/\/python-programs.com\/__trashed-2\/","title":{"rendered":"Python Program to Replace a Word with Asterisks in a Sentence"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Find Sum of Odd Factors of a Number<\/a>
\nGiven a sentence and the task is to replace a word with asterisks in a given Sentence.<\/p>\n

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

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

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

Given string = \"hello this is btechgeeks btechgeeks\"\r\nGiven word to be replaced = \"btechgeeks\"<\/pre>\n

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

The given string [ hello this is btechgeeks btechgeeks ] after replacing with a given word with an asterisk :\r\nhello this is ********** **********<\/pre>\n

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

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

Given string = \"good morning this is btechgeeks good morning all\"\r\nGiven word to be replaced = \"good\"<\/pre>\n

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

The given string [ good morning this is btechgeeks good morning all ] after replacing with a given word with an asterisk :\r\n**** morning this is btechgeeks **** morning all<\/pre>\n

Program to Replace a Word with Asterisks in a Sentence in Python<\/h2>\n

Below are the ways to replace a word with asterisks in a given Sentence:<\/p>\n