Загрузка страницы

10.6 Reassigning Strings (Immutable) | Python programming language

In this video, we explain the concept of immutability in Python strings using simple examples. Strings in Python are immutable, meaning once a string is created, its characters cannot be changed directly.

For example:
```python
text = "HELLO"
text[0] = "Y" # This will raise an error
```

We show how to work around this by creating a new string:
```python
text = "HELLO"
new_text = "Y" + text[1:] # Results in "YELLO"
```

We also explain why strings are immutable and how this affects performance and memory.

#python #strings #immutablestrings #pythonstring #pythonbasics #stringmanipulation #stringreassignment #learnpython #pythonprogramming #codingpython

Видео 10.6 Reassigning Strings (Immutable) | Python programming language канала Binary
Показать
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки