PYTHON WITHOUT def function
Given two inputs: a sentence and a word to be censored. Print out a new sentence with the word censored. In place of the censored word, print "*******", where the number of * characters match the length of the word. The program should censor the exact casing of the word.
Sample Input
Pysics is very hard!I'm very ready! Im very excited
Sample Output
Pysics is **** hard!I'm **** ready! Im **** excited
Python code:
#accepting sentence
sentence=input()
#accepting word
word=input()
#replacing the word in sentence with "*"
sentence=sentence.replace(word,"*"*len(word))
#printing changed sentence
print(sentence)
Screenshot:
Input and Output:
Get Answers For Free
Most questions answered within 1 hours.