Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
So up until now we learned that strings can be accessed quite easily and using the square brackets we
can access different parts of the string.
And this idea of a start a stop and a step over is what we call slicing or String slicing because we
can slice the string.
However we like but we also need to learn another important term that's going to come up again and again
throughout this course.
And as a matter of fact it's an important concept that as you get more advanced into programming you
really need to understand what is this concept.
Well it's this idea of immutability.
It's an important term in programming.
What does immutability mean well strings in Python are immutable.
That means they cannot be changed.
What I mean by that now that we've assigned selfish this value this string.
Well I can reassign it right.
I can say selfish is a hundred now and if I print selfish and I click Run that works but if I instead
do something like the first index of selfish is going to equal 8 and I click Run I get an error I get
a type error saying String object does not support item assignment why is that.
Because strings are immutable.
That is I cannot change the value of this.
Once it's created I can't just immediately change it to eight.
One two three four five six seven.
No.
It has to stay the same.
The only way that I can remove this or change this is to completely reassign the value so that in memory
Python removes all of this from our bookshelf of memory and instead just assigns eight into the zero
bookshelf and removes everything else because we don't use it anymore.
Now this idea of immutability is something we'll explore more and more especially when we start talking
about lists.
But for now just remember that you can't reassign part of a string.
Once created it exists like that in that form.
The only way we can change it is to create something new.
We can do selfish plus 8 and we can create it that way.
But now this selfish is a whole new string.
This no longer exists and a whole new shelf space was created for us to use this whole new string again.
If this doesn't make sense to you or why it's important just yet Don't worry we'll get there.
For now though I'll see in the next video by.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.