%matplotlib inline
# Importing standard Qiskit libraries and configuring account
from qiskit import QuantumCircuit, execute, Aer, IBMQ
from qiskit.compiler import transpile, assemble
from qiskit.tools.jupyter import *
from qiskit.visualization import *
# Loading your IBM Q account(s)
provider = IBMQ.load_account()

# Create a quantum circuit containing three quantum bits, and three classical bits to hold measurement results.
# REPLACE THIS WITH CODE


# REPLACE THIS WITH CODE

def answer(result):
    for key in result.keys():
        state = key
    print('The Quantum 8-ball says:')
    if state == '000':
        print('It is certain.')
    elif state == '001':
        print('Without a doubt.')
    elif state == '010':
        print('Yes - definitely.')
    elif state == '011':
        print('Most likely.')
    elif state == '100':
        print("Don't count on it.")
    elif state == '101':
        print('My reply is no.')
    elif state == '110':
        print('Very doubtful.')
    else:
        print('Concentrate and ask again.')

job = execute(qc, backend=Aer.get_backend('qasm_simulator'), shots=1)
counts = job.result().get_counts(qc)
answer(counts)

from qiskit.quantum_info import Statevector
# REPLACE THIS WITH CODE THAT USES THE from_instruction() 
# AND sample_counts() METHODS OF THE Statevector class

