fork download
  1. def solution(s):
  2.  
  3. total_alphabet = '100000110000100100100110100010110100110110110010010100010110101000111000101100101110101010111100111110111010011100011110101001111001010111101101101111101011'
  4. assert len(total_alphabet) == 26 * 6
  5. mapping = {}
  6. for i,e in enumerate('abcdefghijklmnopqrstuvwxyz'):
  7. mapping[e] = total_alphabet[i * 6: (i+1)*6]
  8. mapping[' '] = '000000'
  9. mapping['capital'] = '000001'
  10.  
  11. # loop through input string.
  12. # For each letter encountered, is it capital or space?
  13. result = ""
  14. for e in s:
  15. upper = False
  16. if e.isupper():
  17.  
  18. upper = True
  19.  
  20. e = e.lower()
  21. print(e)
  22.  
  23. if e in mapping:
  24. if upper:
  25. print("Yup")
  26. result += mapping['capital']
  27. result += mapping[e]
  28.  
  29. return result
  30.  
  31. print(solution("B"))
  32. assert 1 == 2
Success #stdin #stdout 0.01s 7080KB
stdin
Standard input is empty
stdout
b
Yup
000001110000