+ 4

What z the diff btw '==' and 'is' operators in this program??

https://code.sololearn.com/c27g5ys53ALZ/?ref=app

2nd Aug 2017, 3:50 PM
looper
looper - avatar
3 Antworten
+ 9
https://stackoverflow.com/questions/13650293/understanding-pythons-is-operator
2nd Aug 2017, 4:09 PM
Hatsy Rei
Hatsy Rei - avatar
+ 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.
3rd Aug 2017, 6:04 AM
Kirk Schafer
Kirk Schafer - avatar
+ 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
2nd Aug 2017, 3:59 PM
Maya
Maya - avatar