Created
August 3, 2021 17:23
-
-
Save nidhijadhav/c061fd145c209d6eca219a82821ee509 to your computer and use it in GitHub Desktop.
This file contains 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
# Alice chooses her message onto qubit 0. | |
# I choose 11, but you can choose any of the 4 options and test it out | |
msg = "11" | |
# Encode message with appropriate gates | |
if msg == "00": | |
pass # To send 00 we do nothing | |
elif msg == "10": | |
qc.x(0) # To send 10 we apply an X-gate | |
elif msg == "01": | |
qc.z(0) # To send 01 we apply a Z-gate | |
elif msg == "11": | |
qc.z(0) # To send 11, we apply a Z-gate | |
qc.x(0) # followed by an X-gate | |
else: | |
print("Invalid Message") | |
qc.barrier() # Makes diagram neater by seperating gates | |
# Alice sends her qubit to Bob |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment