All language subtitles for 19. Immutability

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian Download
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

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.