human
Program to replace a word with asterisks in a sentence | Function takes two parameter.
Break down sentence by ' ▁ ' spaces and store each individual word in a different list.
A new string to store the result.
Creating the censor which is an asterisks " * " text of the length of censor word.
count variable to access our word_list.
Iterating through our list of extracted words.
changing the censored word to created asterisks censor.
join the words.
Driver code"
How can the above be solved in Python?
 Write me a code to program to replace a word with asterisks in a sentence and the other steps required?
assistant
#Here is code to program to replace a word with asterisks in a sentence and the other steps required.
 def censor ( text , word ) :
	word_list = text . split ( )
	result = ' '
	stars = ' * ' * len ( word )
	count = 0
	index = 0 ;
	for i in word_list :
		if i == word :
			word_list [ index ] = stars
		index += 1
	result = ' ▁ ' . join ( word_list )
	return result
if __name__ == ' _ _ main _ _ ' :
	extract = " GeeksforGeeks ▁ is ▁ a ▁ computer ▁ science ▁ portal ▁ for ▁ geeks . \ 
 	 	 	 I ▁ am ▁ pursuing ▁ my ▁ major ▁ in ▁ computer ▁ science . ▁ "
	cen = " computer "
	print ( censor ( extract , cen ) )