When I type this code:
phrase = 'I love my life'
phrase = phrase.split()
phrase.remove('I')
phrase
I got this result as expected:
['love', 'my', 'life']
However, when I try to make it more concise:
phrase = 'I love my life'
phrase.split().remove('I')
phrase
I have this unexpected result:
'I love my life'
It's strange, what is the difference between phrase = phrase.split() and this object phrase.split()? When we type type(phrase.split()), it's a list as well.
So what is the difference between them? I didn't understand the error, someone could explain to me?