The chat app can add an effect to a message. The effect functions loud and quiet are written and kept in the dict EFFECTS. Write apply_effect(text, name): take the function for that name out of the dict and use it on text. If there's no such effect, return the text unchanged.
apply_effect("Hello", "loud")→'HELLO!'apply_effect("Good Night", "quiet")→'good night...'def loud(text):
return text.upper() + "!"
def quiet(text):
return text.lower() + "..."
EFFECTS = {"loud": loud, "quiet": quiet}
def apply_effect(text, name):
if name not in EFFECTS:
return text
# your code here: take this name's function from EFFECTS, use it on text and return the result
return text
Run tries the examples. When they look right, Submit.