Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Secret Message solution in Creative category for Secret Message by chenli0906
import re
from functools import reduce
def find_message(text: str) -> str:
"""Find a secret message"""
if not list(filter(lambda x: x.isupper(), text)):
return ""
return reduce(lambda x, y: x+y, map(lambda x: ''.join(list(filter(lambda y: y.isupper(), x))), re.sub("[^a-zA-z\s]", '', text).split(' ')))
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert find_message("How are you? Eh, ok. Low or Lower? Ohhh.") == "HELLO", "hello"
assert find_message("hello world!") == "", "Nothing"
assert find_message("HELLO WORLD!!!") == "HELLOWORLD", "Capitals"
print("Coding complete? Click 'Check' to review your tests and earn cool rewards!")
June 30, 2018