Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Easy with regex; lambda if you likey solution in Clear category for Secret Message by lucas.stonedrake
#easy with regex
import re
def find_message(message: str) -> str:
#make a list of any capitals and join them
return ''.join(re.findall('[A-Z]', message))
#lambda if you like
find_message = lambda message: ''.join(re.findall('[A-Z]', message))
if __name__ == '__main__':
print("Example:")
print(find_message(('How are you? Eh, ok. Low or Lower? '
+ 'Ohhh.')))
# These "asserts" are used for self-checking and not for an auto-testing
assert find_message(('How are you? Eh, ok. Low or Lower? '
+ 'Ohhh.')) == 'HELLO'
assert find_message('hello world!') == ''
assert find_message('HELLO WORLD!!!') == 'HELLOWORLD'
print("Coding complete? Click 'Check' to earn cool rewards!")
Nov. 20, 2020