# Strings are Immutable

## Strings are Immutable

```python
my_var = 'abcdefg'

# To replace a with 1:
my_var[0] = "1" # This does not work, it will generate error:
# 'str' object does not support item assignment

# In order for it to work you will have to replace the whole string:
my_var = '1bcdefg'

# To do this programmatically you will have to:
my_var[1:] # Capture everything from the 2nd character
my_var = '1' + my_var[1:] # Add 1 to the captured string and reassign the variable
```


---

# Agent Instructions: 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:

```
GET https://docs.arkannis.net/programming/courses/python-pcap-31-03-course/overview-and-introduction/strings-are-immutable.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
