!pip install -U --user qiskit
!pip install -U --user qiskit_ibm_runtime
!pip install -U --user qiskit_aer
!pip install -U --user matplotlib
!pip install -U --user pylatexenc

import qiskit
import secret

qc = qiskit.QuantumCircuit(2)

qc.h(0)

qc.cx(0, 1)

x = qc.draw(output='mpl')
x

from qiskit.quantum_info import Pauli

ZZ = Pauli('ZZ')
ZI = Pauli('ZI')
IZ = Pauli('IZ')
XX = Pauli('XX')
XI = Pauli('XI')
IX = Pauli('IX')
observables = [ZZ, ZI, IZ, XX, XI, IX]

from qiskit_aer.primitives import Estimator

estimator = Estimator()

job = estimator.run([qc] * len(observables), observables)

job.result()

import matplotlib.pyplot as plt

data = ["ZZ", "ZI", "IZ", "XX", "XI", "IX"]

values = job.result().values

plt.plot(data, values, '-o')
plt.xlabel('Observables')
plt.ylabel('Expectation value')
plt.show()