Qbits on Python

This summer I was browsing my feed in youtube when I happened to cross paths with this video on quantum mechanics, the video which I absolutely recommend if you understand Spanish forms part of a three video series explaining what quantum bits are and how they can be used to form channels that seem to be 100% private when used on a determined way. I was super intrigued by this “Qbits” so I started making research and decided to create a simulation of them in python to try to make this private channels, so far I have a very simple simulation of how the qbits work but I think it is enough to start trying to recreate those private channels. Who knows, I might even try to make it into an application. This is the qbit simulation code so far:

import random
x_axis = ""
y = 0
zero = 0
valor_qbit = 0

x = random.randint(0, 1)
if x == 0:
    x_axis += "right"
    valor_qbit += x
elif x == 1:
    x_axis += "left"
    valor_qbit += x

y += random.randint(0, 1)

prompt = input('''
    > Print x_axis
    
    > Print y_axis

''')

if prompt.lower() == "print x_axis":
    print(x_axis)

elif prompt.lower() == "print y_axis":
    print(y)

else:
    print("I could not understand what you were trying to do.")

Im sorry if the code is unclear or can be simplified but this is one of my first projects.

Leave a comment

Website Powered by WordPress.com.

Up ↑