You're correct that == and is are not the same thing. However, that code does indeed work as I posted (I tested it). Strings are immutable, meaning that richestDuck is "Scrooge McDuck" evaluates to True on the basis that richestDuck is bound directly to the immutable string literal "Scrooge McDuck".
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You're correct that
==
andis
are not the same thing. However, that code does indeed work as I posted (I tested it). Strings are immutable, meaning thatrichestDuck is "Scrooge McDuck"
evaluates toTrue
on the basis thatrichestDuck
is bound directly to the immutable string literal"Scrooge McDuck"
.