> ## Documentation Index
> Fetch the complete documentation index at: https://docs.classiq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Walk-Through: `prepare_state`

> **[View on GitHub](https://github.com/Classiq/classiq-library/blob/main/tutorials/basic_tutorials/prepare_state/prepare_state.ipynb)**
>
> Open this notebook in GitHub to run it yourself

This notebook is the Classiq SDK equivalent of the walkthrough sequence as presented in the Classiq web IDE \[[1](#classiq-ide)].

```python theme={null}
from classiq import *
```

## Build Your Algorithm

**In the IDE:**  To start writing your quantum model, click the `Model` tab.

## Build the Model

**In the IDE:** Here you define the model, function parameters, and more.

See the User Guide \[[2](#user-guide)] for details.

*Below is the SDK representation of the Qmod syntax shown on the IDE page:*

```python theme={null}
probabilities = [
    0,
    0.002,
    0.004,
    0.006,
    0.0081,
    0.0101,
    0.0121,
    0.0141,
    0.0161,
    0.0181,
    0.0202,
    0.0222,
    0.0242,
    0.0262,
    0.0282,
    0.0302,
    0.0323,
    0.0343,
    0.0363,
    0.0383,
    0.0403,
    0.0423,
    0.0444,
    0.0464,
    0.0484,
    0.0504,
    0.0524,
    0.0544,
    0.0565,
    0.0585,
    0.0605,
    0.0625,
]


@qfunc
def main(io: Output[QArray]):
    prepare_state(probabilities=probabilities, bound=0.01, out=io)
```

## Synthesize the Model

**In the IDE:** Now that you have selected or built a model, click the "Synthesize" button, sit back, and let Classiq do its magic!

*Below is the SDK representation of the Qmod syntax shown on the IDE page:*

```python theme={null}
qprog = synthesize(main)
show(qprog)
```

> [!NOTE]
>
> **Output:**
>
> ```
>
> Quantum program link: https://platform.classiq.io/circuit/3Ij4vVGyUQgwNZxr3yX0LaukK0F
>
>
> ```

> [!NOTE]
>
> **Output:**
>
> ```
> https://platform.classiq.io/circuit/3Ij4vVGyUQgwNZxr3yX0LaukK0F?login=True&version=22
>
>
> ```

## Congratulations!

**In the IDE:** This is your first quantum program.

Learn more in the User Guide \[[2](#user-guide)].

## Run on Quantum Hardware or Simulators

**In the IDE:** Click 'Execute' to define the quantum hardware or a quantum simulator to run your synthesized quantum program.

## Define Execution Details

**In the IDE:** Select which quantum program to execute, define the execution parameters, and choose a quantum provider and backend platform.

The Classiq platform is your gateway to all major quantum computing providers.

## Run on a Quantum Simulator!

**In the IDE:** Click 'Run' to execute your quantum program on the simulator you chose in the previous step.

*Below is the SDK execution code:*

```python theme={null}
df = sample(qprog)
```

> [!NOTE]
>
> **Output:**
>
> ```
>
> Submitting job to simulator
>
>
> ```

> [!NOTE]
>
> **Output:**
>
> ```
>
> Job: https://platform.classiq.io/jobs/39a603e7-64fa-471d-b74a-f6bdc1215157
>
>
> ```

```python theme={null}
df.head()
```

| | io | counts | probability | bitstring |
| - | - | - | - | - |
| 0 | \[1, 1, 1, 1, 1] | 131 | 0.063965 | 11111 |
| 1 | \[0, 1, 1, 1, 1] | 128 | 0.062500 | 11110 |
| 2 | \[0, 0, 1, 1, 1] | 125 | 0.061035 | 11100 |
| 3 | \[1, 1, 0, 1, 1] | 115 | 0.056152 | 11011 |
| 4 | \[1, 0, 1, 1, 1] | 107 | 0.052246 | 11101 |

Look at that cool triangle probability function!
**In the IDE:** That's it! You ran your first quantum program.

To learn more about the Classiq platform, read the User Guide \[[2](#user-guide)].

## References

\[1]: [Classiq IDE](https://platform.classiq.io/)

\[2]: [Classiq User\_Guide](https://docs.classiq.io/latest.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.