Python Strings Are NOT What You Think!! #python #programming #coding

preview_player
Показать описание
This video explains the answer to a poll I held in which string are immutable.

Background Music:
Attribution 4.0 International (CC BY 4.0)
Рекомендации по теме
Комментарии
Автор

I like your content, Im about to graduate with a cs degree and I think your vids are really informative for intermediate programmers.

philstanton
Автор

Finally, I can now understand what is mutable and immutable in Python.

awaisanimation
Автор


I also remember finding this poll like when it was 11 seconds old
I remember people saying "bro the replace function doesn't do anything" and "the 3rd line doesnt change anything" bc i put 1bcdef
I understood the latter but not the first one

Turbogames_tuwr_old
Автор

You don't assign the results to x. x.replace doesn't modify the string. x = x.replace does.

You can't update strings in python; only reassign them. Strings are immutable.

notjustforme
Автор

I remember I had an issue where I couldn't replace a character when I called the replace method and couldn't get it to work. Then I did something like "var_name = var_name.replace(a, b)". And I of course got it to work.

pyp
Автор

My thoughts watching the video: "Well, it's an obvious little 'gotcha' question, the x.replace doesn't change x, so it should be abcdef of course" 10 seconds later "ohhh, you little shit, you got me". 😂

karim_ghibli
Автор

My thought said 1bc but I didn’t know callables can’t change variables unless it was called for

rogelioayus
Автор

I was looking at the code like what is bro doing lines 2, 3?!?

yhwhlungs
Автор

You youtubers need to stop the 'it's not what you think' intro. Just because another popular channel uses that catch phrase, it doesn't mean that it will automatically make your channel explode with subscribers. You know what makes a channel gain popularity? Good content, released on a consistent schedule, covering an interesting topic. You have those points covered, so it's not necessary to copy another channel's annoying catch phrase.

But, i appreciate your videos. Keep them coming!

CM-xroq
Автор

like I'd understand if people were going all in on B. That one is an understandable mistake. But C? come one, at least with the .replace method it's unusual in not effecting the original object!

nobodyofconsequence
Автор

This is the best yt channel ever. I learned so much with you

justaregularguy
Автор

I saw the def thing but didn't see the replace one, i kept saying B but at the last second i realized my problem

DigitalHandle
Автор

It's the common mistake that almost every one makes and later realise it after debugging.

FC
Автор

Thanks for making these short but effective videos.

softcoda
Автор

those do not override data but return new data,
a example of a function that override data is reverse in list which reverse list order

gamingland
Автор

Why ??
Are should to assign with variable ?

MgM-zfpw
Автор

before the end: it's "abc"

edit: knew it :)

modley_the_m_guy
Автор

and you just expect me to know that I can't use replace like that?

znoppen
Автор

Its nice seeing that most dont get the answer

clipstobingeon
Автор

Never thought my texting reflexes would betray my brain, I thought it was B...

heatspace