بکندباز

تابعی ایجاد کنید که در پارامتر اول یک رشته txt را بگیرد و هر کلمه ای که در لیست پارامتر دوم قرار داشت را از آن سانسور کند. متن سانسور شده باید با کاراکتر داده شده در پارامتر سوم جایگزین شود.

نمونه ورودی و خروجی

censor_string("Today is a Wednesday!", ["Today", "a"], "-") ➞ ----- is - Wednesday!

censor_string("The cow jumped over the moon.", ["cow", "over"], "*") ➞ The *** jumped **** the moon.

censor_string("Why did the chicken cross the road?", ["did", "chicken", "road"], "*") ➞ Why *** the ******* cross the ****?
 

censor_string("Today is a Wednesday!", ["Today", "a"], "-")  ➞ ----- is - Wednesday!
censor_string("The cow jumped over the moon.", ["cow", "over"], "*")  ➞ The *** jumped **** the moon.
censor_string("Why did the chicken cross the road?", ["did", "chicken", "road"], "*")  ➞ Why *** the ******* cross the ****?

هنوز پاسخی برای این تمرین ثبت نشده است

نظرات

*
*