# I am a comment in python

print("Hello From Quantum World :-)")

# please run this cell

# import the objects from qiskit
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, execute, Aer
from random import randrange

# create a quantum circuit and its register objects
qreg = QuantumRegister(2) # my quantum register
creg = ClassicalRegister(2) # my classical register 
circuit = QuantumCircuit(qreg,creg) # my quantum circuit

# apply a Hadamard gate to the first qubit

circuit.h(qreg[0])

# set the second qubit to |1>
circuit.x(qreg[1])

# apply CNOT(first_qubit,second_qubit)
circuit.cx(qreg[0],qreg[1])

# measure the both qubits
circuit.measure(qreg,creg)

print("The execution of the cell was completed, and the circuit was created :)")

## execute the circuit 100 times
job = execute(circuit,Aer.get_backend('qasm_simulator'),shots=1024)
# get the result
counts = job.result().get_counts(circuit)
print(counts)

# draw circuit 
circuit.draw(output='mpl')

# the output will be a "matplotlib.Figure" object

