





'''simple docstring'''






def        UpperCamelCase__		(						__magic_name__  :   int      )				->			list:
 '''simple docstring'''






 if bit_count < 0:
  raise ValueError("""The given input must be positive"""      )

 # get the generated string sequence
 snake_case__     :					str    =  gray_code_sequence_string(__magic_name__      )
 #
 # convert them to integers
 for i in range(len(__magic_name__      )      ):
  snake_case__     :					Optional[int]    =  int(sequence[i]		,       2      )

 return sequence



def        UpperCamelCase__		(						__magic_name__  :   int      )				->			list:
 '''simple docstring'''






 if bit_count == 0:
  return ["0"]

 if bit_count == 1:
  return ["0", "1"]

 snake_case__     :					str    =  1 << bit_count  # defines the length of the sequence
 # 1<< n is equivalent to 2^n

 # recursive answer will generate answer for n-1 bits
 snake_case__     :					Optional[int]    =  gray_code_sequence_string(bit_count - 1      )

 snake_case__     :					List[Any]    =  []

 # append 0 to first half of the smaller sequence generated
 for i in range(seq_len // 2      ):
  snake_case__     :					Tuple    =  """0""" + smaller_sequence[i]
  sequence.append(__magic_name__      )

 # append 1 to second half ... start from the end of the list
 for i in reversed(range(seq_len // 2      )      ):
  snake_case__     :					Tuple    =  """1""" + smaller_sequence[i]
  sequence.append(__magic_name__      )

 return sequence


if __name__ == "__main__":
    import doctest

    doctest.testmod()








'''simple docstring'''
__SCREAMING_SNAKE_CASE					:				Optional[int]									=		{
    '''a''': '''AAAAA''',
    '''b''': '''AAAAB''',
    '''c''': '''AAABA''',
    '''d''': '''AAABB''',
    '''e''': '''AABAA''',
    '''f''': '''AABAB''',
    '''g''': '''AABBA''',
    '''h''': '''AABBB''',
    '''i''': '''ABAAA''',
    '''j''': '''BBBAA''',
    '''k''': '''ABAAB''',
    '''l''': '''ABABA''',
    '''m''': '''ABABB''',
    '''n''': '''ABBAA''',
    '''o''': '''ABBAB''',
    '''p''': '''ABBBA''',
    '''q''': '''ABBBB''',
    '''r''': '''BAAAA''',
    '''s''': '''BAAAB''',
    '''t''': '''BAABA''',
    '''u''': '''BAABB''',
    '''v''': '''BBBAB''',
    '''w''': '''BABAA''',
    '''x''': '''BABAB''',
    '''y''': '''BABBA''',
    '''z''': '''BABBB''',
    ''' ''': ''' ''',
}


__SCREAMING_SNAKE_CASE					:				Tuple									=		{value: key for key, value in encode_dict.items()}







def       a_				(	UpperCamelCase_ ):
							A_			    =		""
							for letter in word.lower():
														if letter.isalpha() or letter == " ":
																					encoded += encode_dict[letter]
														else:
																					raise Exception("encode() accepts only letters of the alphabet and spaces" )
							return encoded







def       a_				(	UpperCamelCase_ ):
							if set(UpperCamelCase_ ) - {"A", "B", " "} != set():
														raise Exception("decode() accepts only 'A', 'B' and spaces" )
							A_			    =		""
							for word in coded.split():
														while len(UpperCamelCase_ ) != 0:
																					decoded += decode_dict[word[:5]]
																					A_			    =		word[5:]
														decoded += " "
							return decoded.strip()


if __name__ == "__main__":
							from doctest import testmod

							testmod()





