Skip to content

Instantly share code, notes, and snippets.

View quantumjim's full-sized avatar

James Wootton quantumjim

View GitHub Profile
# I ran the following code
device = 'ibmqx4'
print(engine.get_qasm("script"))
qobj = engine.compile(["script"], backend=device)
print(engine.get_compiled_qasm(qobj,"script"))
executedJob = engine.execute(["script"], backend=device, shots=shots, max_credits = 5, wait=2, timeout=600, silent=False)
# obviously there was a whole lot of stuff before it too, setting up the code
@quantumjim
quantumjim / Engine.py
Last active May 16, 2022 15:06
Gamified tutorial for QISKit to run on PythonAnywhere
# -*- coding: utf-8 -*-
import math
def ClearScreen () :
# DESCRIPTION:
# Prints a whole bunch of space to screen
print("\n"*200)
def ColouredString (message,colour) :
# coding: utf-8
from creative import *
def clear_screen():
for _ in range(50):
print("")
def get_percentage(stats,string):
import pygame
import select
import sys
class TimeoutExpired(Exception):
pass
def timed_input (prompt, timeout):
sys.stdout.write(prompt)
qr = QuantumRegister(2)
qc = QuantumCircuit(qr,cr)
qc.h( qr[0] )
qc.cx( qr[0], qr[1] )
qc.ry( np.pi/4, qr[1])
qc.h( qr[1] )
qc.h(qr[0])
qc.h(qr[1])
from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit, execute
shots = 1024
n = 10
batch = []
for run in range(n):
qr = QuantumRegister(1)
cr = ClassicalRegister(1)
qc = QuantumCircuit(qr, cr)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import random