from qiskit.opflow.state_fns import StateFn

statefn = StateFn('10100')
print(statefn)

from qiskit import QuantumCircuit

qc = QuantumCircuit(3)
qc.h(0)
qc.cx(0, 1)
qc.cx(1, 2)

statefn = StateFn(qc)
print(statefn)

import numpy as np

statefn = StateFn([1, 0, 0, 1] / np.sqrt(2))
print(statefn)

from qiskit.opflow.state_fns import StateFn
from qiskit.opflow import One, Zero
 
statefn_a = StateFn('100', is_measurement=True)
print('statefn_a:', statefn_a, statefn_a.is_measurement)

statefn_b = ~(One ^ Zero ^ Zero)
print('statefn_b:', statefn_b, statefn_b.is_measurement)