Skip to content

Commit

Permalink
Resolve "possibly unbound" error
Browse files Browse the repository at this point in the history
  • Loading branch information
EarlMilktea committed Nov 8, 2023
1 parent 68f21b4 commit 894afd3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions example/grover.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def grover(v, target, iter):
elif len(sys.argv) == 3:
n = int(sys.argv[1])
target = q.util.str2binary(sys.argv[2])
else:
msg = "len(sys.argv) must be 1 or 3"
raise ValueError(msg)
iter = 2 ** (n // 2)
print("# number of qbits = {}".format(n))
print("# target state = {}".format(q.util.binary2str(n, target)))
Expand Down

0 comments on commit 894afd3

Please sign in to comment.