qiskit/visualization/state_visualization.py
def bit_string_index(s):
    """Return the index of a string of 0s and 1s."""
    n = len(s)
    k = s.count("1")
    if s.count("0") != n - k:
        raise VisualizationError("s must be a string of 0 and 1")
    ones = [pos for pos, char in enumerate(s) if char == "1"]
    return lex_index(n, k, ones)
def bit_string_index(s):
    """Return the index of a string of 0s and 1s."""
    n = len(s)
    k = s.count("1")
    if s.count("0") != n - k:
        raise VisualizationError("s must be a string of 0 and 1")
    ones = [pos for pos, char in enumerate(s) if char == "1"]
    return lex_index(n, k, ones)
def bit_string_index ( s ) : n = len ( s ) k = s . count ( "1" ) if s . count ( "0" ) != n - k : raise VisualizationError ( "s must be a string of 0 and 1" ) ones = [ pos for pos , char in enumerate ( s ) if char == "1" ] return lex_index ( n , k , ones )
Return the index of a string of 0s and 1s.
Return the index of a string of 0s and 1s .