> For the complete documentation index, see [llms.txt](https://suresheet-docs.equalto.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://suresheet-docs.equalto.com/python-examples.md).

# Python examples

These examples use the [Investment Growth Calculator](https://www.equalto.com/suresheet/view/abc7cbef-2491-4787-94f8-6542fab12a4e) SureSheet, and do not depend on any third-party libraries.

### Simple example

```python
import urllib.request
from urllib.parse import quote
import json
workbook_id = "abc7cbef-2491-4787-94f8-6542fab12a4e"
inputs = json.dumps({"Sheet1":{"C6":25000}})
outputs = json.dumps({"Sheet1":["C13"]})
simulate_url = f"https://www.equalto.com/suresheet/api/v1/simulate/{workbook_id}?inputs={quote(inputs)}&outputs={quote(outputs)}"

with urllib.request.urlopen(simulate_url) as response:
    results = json.loads(response.read())

print(results)

```

Should print:

```json
{'Sheet1': {'C13': 50783.31719489607}}
```

### Advanced example with ranges

```python
import urllib.request
from urllib.parse import quote
import json
workbook_id = "abc7cbef-2491-4787-94f8-6542fab12a4e"
inputs = json.dumps({"Sheet1":{"C6":25000}})
outputs = json.dumps({"Sheet1":["C13", "B14:C16"]})
simulate_url = f"https://www.equalto.com/suresheet/api/v1/simulate/{workbook_id}?inputs={quote(inputs)}&outputs={quote(outputs)}"

with urllib.request.urlopen(simulate_url) as response:
    results = json.loads(response.read())

print(json.dumps(results, indent=4))
```

Should print:

```json
{
    "Sheet1": {
        "C13": 50783.31719489607,
        "B14:C16": [
            [
                "   Initial investment amount:",
                25000.0
            ],
            [
                "   Additional contributions:",
                10500.0
            ],
            [
                "   Interest earned:",
                15283.31719489607
            ]
        ]
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://suresheet-docs.equalto.com/python-examples.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
