Into Quantum

Into Quantum

How To Create Quantum Circuits With Qiskit

Solution to Question 1 and 2 of the ongoing Quantum programming challenge

Dr. Ashish Bamania's avatar
Dr. Ashish Bamania
Dec 19, 2025
∙ Paid
A generated image based on your input prompt

Hey everyone!

Last week, I published a challenge with 6 Qiskit questions to get started with Quantum Computing.

Here are the solutions to the first two questions from the challenge.


Question 1

Create a 1-qubit quantum circuit that:

  1. Starts in the state |0>

  2. Applies a Hadamard gate

  3. Measures the qubit

Write the Qiskit code and simulate the circuit using a Qiskit simulator.


Solution 1

We start by installing Qiskit and the Qiskit Aer library.

Qiskit Aer is a high-performance library with realistic noise models to run quantum computing simulations on classical computers.

!uv pip install qiskit qiskit-aer 

If you’re interested in running the following code on a real quantum computer, refer to the following article.

A Practical Guide To Running Your First Program On An IBM Quantum Computer

A Practical Guide To Running Your First Program On An IBM Quantum Computer

Dr. Ashish Bamania
·
Mar 28
Read full story

Next, we import the necessary packages.

from qiskit import QuantumCircuit # To create and manipulate quantum circuits

from qiskit_aer import Aer # Qiskit simulator backend 

from qiskit.visualization import plot_histogram # To visualise measurement results 

We then create the quantum circuit using QuantumCircuit(1, 1) where the:

  • First 1 represents one qubit. This qubit is in state |0>.

  • Second 1 represents one classical bit used to store the measurement result.

# Create circuit 
circuit = QuantumCircuit(1, 1) 

Next, we apply the Hadamard gate to the qubit and then measure it.

# Apply Hadamard gate to qubit at index 0
circuit.h(0) 

# Measure qubit at index 0 and store in classical bit at index 0
circuit.measure(0, 0) 
User's avatar

Continue reading this post for free, courtesy of Dr. Ashish Bamania.

Or purchase a paid subscription.
© 2025 Dr. Ashish Bamania · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture