I'm new to Python. Trying to make a simple function that converts a string input to braille via dict values (with '1' indicating a bump and 0 no bump).
I'm sure there are faster/better ways to do this but what I have is almost working (another way of saying it doesn't work at all).
alphabet = {
'a': '100000','b': '110000','c': '100100','d': '100110'
#etc
}
def answer(plaintext):
for i in str(plaintext):
for key, value in alphabet.iteritems():
if i in key:
print value,
answer('Kiwi')
This prints:
000001101000 010100 010111 010100
My question is how do I remove the spaces? I need it to print as:
000001101000010100010111010100
It's printing as a tuple so I can't use .strip().