You’re doing great with these string function challenges. Last one!



Write a function called censor that takes two strings, text and word, as input. It should return the text with the word you chose replaced with asterisks. For example:

censor("this hack is wack hack", "hack") ``` should return: ```py "this **** is wack ****"
  • Assume your input strings won’t contain punctuation or upper case letters.
  • The number of asterisks you put should correspond to the number of letters in the censored word.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?