Created
December 21, 2018 17:03
-
-
Save ericorruption/812760344270a7f23cec3364944bf0ee to your computer and use it in GitHub Desktop.
Google task 1 solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
braille = { | |
' ': '000000', | |
'a': '100000', | |
'b': '110000', | |
'c': '100100', | |
'd': '100110', | |
'e': '100010', | |
'f': '110100', | |
'g': '110110', | |
'h': '110010', | |
'i': '010100', | |
'j': '010110', | |
'k': '101000', | |
'l': '111000', | |
'm': '101100', | |
'n': '101110', | |
'o': '101010', | |
'p': '111100', | |
'q': '111110', | |
'r': '111010', | |
's': '011100', | |
't': '011110', | |
'u': '101001', | |
'v': '111001', | |
'w': '010111', | |
'x': '101101', | |
'y': '101111', | |
'z': '101011' | |
} | |
def answer(plaintext): | |
result = '' | |
for character in plaintext: | |
if character != ' ' and character == character.upper(): | |
result += '000001' | |
character = character.lower() | |
result += braille[character] | |
return result | |
print(answer(' ')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment