microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
ec5f0622afa8a738be43f51294fa8bdeaee73ff9

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

samples/python_interop/generating_n_random_bits/README.md

3lines · modepreview

# Passing arguments from Python to Q# and processing measurement results in Python

In this example, a Q# program generates an array of random bits of user-defined length (`nQubits`). The program creates a random bit sequence by applying an $H$ gate to each of the qubits, measuring them, and returning a tuple containing the measurement results in an array along with the integer representation of the generated bits or the random number. The Python program then processes the resulting array of bits by counting the number of `One`s and displays this count along with the array of random bits and the integer representation of the generated bits.