← Back to Strings
Question 306
Censor the Secret Word
Censor the Secret Word
Combine Replace and Contains to censor sensitive text and then verify your work. You are given a string named message set to "the password is secret". First use Replace to swap the word "secret" for "*****", storing the result in a new variable, and print that censored message. Then print whether the censored text still contains "secret" using Contains — since it was replaced, the answer should be False (printed with a capital F).
Expected Output:
the password is ***** False
= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Strings
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.