Quantum Computing Asked by LOC on December 2, 2020
I am running a simple 3 qubit circuit which produces the following results:
{'000': 5, '001': 3, '010': 10, '100': 5, '101': 7, '110': 7, '111': 4}
There are no counts of 011. Is there a simple way within qiskit to also return the result ‘011’: 0? So the final results would be
{'000': 5, '001': 3, '010': 10,'011': 0, '100': 5, '101': 7, '110': 7, '111': 4}
Currently when I run this circuit I get an error as I am trying to call res[‘011’], where res is the list of results. I cannot just increase the number of shots unfortunately I am constrained to this number of qubits.
You can use .get() and return zero as the default value.
res.get('011', 0)
Correct answer by tsgeorgios on December 2, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP