# Codercise G.5.1 - Preparing a multi-solution oracle

**URL:** <https://discuss.pennylane.ai/t/codercise-g-5-1-preparing-a-multi-solution-oracle/9335>\
**Category:** Codebook\
**Created:** [May 12, 2026, 9:22am UTC](https://discuss.pennylane.ai/t/codercise-g-5-1-preparing-a-multi-solution-oracle/9335 "2026-05-12T09:22:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![delacroissant](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@delacroissant](https://discuss.pennylane.ai/u/delacroissant)\
**Post date:** [May 12, 2026, 9:22am UTC](https://discuss.pennylane.ai/t/codercise-g-5-1-preparing-a-multi-solution-oracle/9335/1 "2026-05-12T09:22:39Z")

</div>

In Codercise G.5.1 it is written:

Let’s start by coding up this new oracle. Create an oracle for a random solution set of a given size using the [`MultiControlledX`](https://pennylane.readthedocs.io/en/stable/code/api/pennylane.MultiControlledX.html) gate. Remember that this takes a string for `control_values` (e.g.,`"11011"`) as a parameter rather than a list of bits.

However, when trying to implement the above gate as qp.MultiControlledX(all\_wires,control\_values=“11011”), it results in a ValueError: control\_values must be boolean or int.

Indeed, in the official PennyLane documentation for the qml.MultiControlledX class, it is reported:

**control\_values** (_Union[bool, list[bool], int, list[int]]_) – The value(s) the control wire(s) should take. Integers other than 0 or 1 will be treated as `int(bool(x))`.

This is confirmed also by the official solution provided for Codercise G.5.1, which is:

```auto
def oracle_multi(combos):
   """Implement multi-solution oracle using sequence of multi-controlled 
   X gates.
   Args:
       combos (list[list[int]]): A list of solutions.
   """
   for combo in combos:

       qp.MultiControlledX(wires=range(n_bits + 1), control_values=combo)

```

For this reason, I believe that the initial remark about control\_values is misleading and should be corrected.

---

<div class="post-metadata">

**Author:** ![dren](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/dren/32/4183_2.png) [@dren](https://discuss.pennylane.ai/u/dren)\
**Post date:** [May 13, 2026, 4:10pm UTC](https://discuss.pennylane.ai/t/codercise-g-5-1-preparing-a-multi-solution-oracle/9335/2 "2026-05-13T16:10:11Z")

</div>

Hi again @delacroissant , thanks for pointing this out to us!

Indeed, I would agree that the language surrounding `control_values` is misleading and must be changed. Correspondingly, I have made an update to the language that should be live soon. Yesterday, we launched PennyLane v0.45 (Check out the blog: [Assemble meaningful algorithms with PennyLane v0.45 and Catalyst v0.15 | PennyLane Blog](https://pennylane.ai/blog/2026/05/pennylane-release-0.45)), so we needed to wait for that to be available before making changes.

Thanks again!

— David
