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
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
Показать
Комментарии отсутствуют
Информация о видео
5 апреля 2025 г. 12:57:18
00:02:09
Другие видео канала




















