+ 4
What z the diff btw '==' and 'is' operators in this program??
3 Answers
+ 9
https://stackoverflow.com/questions/13650293/understanding-pythons-is-operator
+ 5
Combine the answers already posted with this code:
https://code.sololearn.com/cz4Pe3g9zJ7X/?ref=app
Two strings at the same address are the same entity (variables referencing a single constant). At different addresses, they can have equivalent values, but they are not the same entity.
+ 4
== compares the values of the strings
is compares the identities, so 'is' would return True if:
h = 'kavya'
p = h
h is p = True