Based on the section Introduction to Quantum Error Correction using Repetition Codes from the Qiskit textbook.https://qiskit.org/textbook/ch-quantum-hardware/error-correction-repetition-code.html