Fundamentally, quantum computing is different from classical computing because of the physical laws working "under the hood" of the computer. To understand quantum computing in this light, it's useful to treat nature as a sort of black box. It takes an initial state of a system as an input, performs changes on it governed by physical laws, and outputs experimental data (aka measurements) at the end. We can try to infer the laws of nature by looking at the pattern of input states and output measurements.

Let's start with a simple deterministic warm-up example, where the same input always leads to the same output.

In the code box below, you can print the result of applying the box to an arbitrary list of bits (zeros or ones) using secret_box(bits). Here are some examples:

secret_box([0,1,0,1,1]) = [1,0,1,1,0] secret_box([1,1,0,0,1,0,1]) = [1,0,0,1,0,1,1]

Do you think you know what the patern is? You can generate more examples using the provided code. Once you are sure, complete the deterministic_box function that implements the secret deterministic rule.

The output of your deterministic_box fuction must have the same length as the input.

input = [1, 1, 0] # MODIFY EXAMPLE
output = secret_box(input)
print("The result of applying the secret box to ", input, "is ", output)
# We will secretly apply the function and return the result!

def deterministic_box(bits):
"""Guess the secret deterministic rule.
Args:
bits (list[int]): A list of bits representing an initial condition.
Returns:
list[int]: The output bits measured after deterministic evolution.
"""
##################
# YOUR CODE HERE #
##################
return bits # MODIFY THIS


or to submit your code

To interact with codercises, please switch to a larger screen size.

Learning Objectives:

  • Describe the distinction between the behaviour of deterministic, random, and quantum systems.