- rebecca4670
The Beginner's Guide to Programming a Real Live Quantum Computer
What if I told you that in the next 10 minutes you can write and run a program on a real quantum computer without having to write a single line of code? With IBM’s Q Experience, what might seem like science fiction is available right at our fingertips. In this tutorial, I’ll first show you how to build and run your first quantum program using IBM’s visual editor. Then for the adventurous, I’ll demonstrate how to get your own quantum development environment set up so you can start programming your very own quantum algorithms!
Allow me to introduce you to the IBM QX Composer tool

I’m going to breeze through this mini-tutorial, but you can find a detailed guide on the IBM Q site. It’s worth a read-through especially if you’re new to the wonderful world of quantum computing.
The interface allows you to drag and drop icons from the right panel of the screen onto the diagram to the left. The horizontal lines labeled q[0] to q[4] each represent a qubit. The colorful icons represent gates and operations you can apply to a qubit. These little guys below help you operate on a given qubit in the following ways:

Once you’ve completed the operations and are ready to measure the state, drag the pink icon to the end of the line. You can then simulate your program or choose to run it, et voila! IBM will queue your program and once resources are available, they’ll run your program on a real-life quantum computer and send you the results!
Now, if you’re sitting there thinking “that was great, but I wish I could do even more!”, you’re in luck! IBM QX also lets you run your own code on their quantum computers for free!
First, if you haven’t already. you’ll need to sign up for an IBM Q Experience account. Once you’ve logged in, you can request an API token here (we’ll be using this in our code to get access to IBM’s quantum computing resources) and we can get rolling.
I won’t pretend the basic quantum computing concepts are easy to grasp, and it helps if you have some background in python programming, physics and math. That being said, there is a growing quantum community that is creating wonderful tutorials - like this one - that are written for absolute beginners.
As a side note for beginners, python is great because it’s a bit more intuitive to pick up if you’re a first time coder. There is also a thriving development community that builds and shares open source tools for all python users. Maybe that’s why Rigetti, DWave, Google and IBM all released software development kits built in python.
In the rest of the tutorial, I’ll be assuming you have some familiarity with python. If not, I recommend completing the first few lessons in the above tutorial before jumping back in here.
In every programming language, there is the concept of the ‘hello world’ program. This is generally the simplest possible program you can write in that framework. Here I’ll be showing you the quantum-equivalent of ‘hello world’!
We’re going to be using Qiskit which is a great full-stack open-source quantum computing framework supported by IBM. Our first step is to install Qiskit on your computer.
Open a terminal or command prompt window and create the directory where you’ll be keeping your code.
$ mkdir your_file_name
Now navigate to the directory using:
$ cd path/to/your_file_name
We’re going to install Qiskit inside the directory using:
$ pip install qiskit
You may run into issues with not having dependencies installed. If so, just continue to use pip install on the missing package names until the qiskit install runs clean.
Finally, let’s create a file inside the directory called ‘hello_quantum.py’ and open it in your favorite editor. Now let’s start coding!

And there you have it, your declaration to the world that you are officially a quantum programmer! Go forth and entangle some qubits!