Last active
August 25, 2020 17:07
-
-
Save stevenheidel/15a7ff8b2613e16d3896f2fc4d446563 to your computer and use it in GitHub Desktop.
medium-braket-5.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from braket.circuits import Circuit | |
from braket.aws import AwsDevice | |
import time | |
s3_folder = ("[insert s3 bucket name]", "simulation-output") | |
device = AwsDevice("arn:aws:braket:::device/qpu/rigetti/Aspen-8") | |
coin_flip_circuit = Circuit().h(0) | |
task = device.run(coin_flip_circuit, s3_folder, shots=10) | |
while task.state() in ['CREATED', 'QUEUED']: | |
print(time.ctime(), 'Waiting...') | |
time.sleep(60) | |
result = task.result() | |
if result.measurements[0][0] == 1: | |
print("HEADS!") | |
else: | |
print("TAILS!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment