microsoft/qdk

Public

mirrored from https://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
minestarks/dev-container

Branches

Tags

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

Clone

HTTPS

Download ZIP

katas/content/marking_oracles/parity/Verification.qs

25lines · modecode

1namespace Kata.Verification {
2 import KatasUtils.*;
3
4 function F_Parity(x : Bool[]) : Bool {
5 mutable parity = false;
6 for xi in x {
7 if xi {
8 set parity = not parity;
9 }
10 }
11 parity
12 }
13
14 @EntryPoint()
15 operation CheckSolution() : Bool {
16 for n in 1..5 {
17 if not CheckOracleImplementsFunction(n, Kata.Oracle_Parity, F_Parity) {
18 return false;
19 }
20 }
21
22 Message("Correct!");
23 true
24 }
25}