I want to censor some text | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I want to censor some text

from string import punctuation as p A="ooh shoot, I thought I had the dang problem figured out. Darn it. Oh well, it was a heck of a freakin try" for c in p: A=A.replace(c,' ') A=A.lower() A=A.split() for x in A: for m in range(len(x)): k=len(x) j="*"*k print(x,j,k) """In the given text, I want to write a program that censors the words shoot, dang, darn, heck and freakin. The words should be replaced with an * which be equal to the length of the words being replaced. So that we end up with: Ooh *****, I thought I had the **** problem figured out. **** it. Oh well, it was a **** of a ******* try""" https://code.sololearn.com/cZPHVjNkuDbV/?ref=app

7th Jul 2018, 9:17 AM
Joash Ouso
Joash Ouso - avatar
1 Answer
+ 7
Check out a reply in your other thread on the subject: https://www.sololearn.com/Discuss/1391267/?ref=app Perhaps you could delete this one, too :)
7th Jul 2018, 12:21 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar