+ 1

Why the line 7 is giving different out put for same type of data....?

https://code.sololearn.com/c6XIhesQg17h/?ref=app By default any input entered by the user is of type string. Then by entering savit twise the line 7 is giving False by entering 3 twise it's giving True. Once the "savit" Is treated as single object then both x and y are pointing to same object then it should show o/p as True.Can any one please explain...?

25th Jun 2022, 7:46 AM
Pythonist
Pythonist - avatar
5 ответов
+ 1
I assume because they are input and not literals translated at runtime like the literal strings that are the same
25th Jun 2022, 8:48 AM
Slick
Slick - avatar
0
'is' has to do with their IDs (or addresses), not data type. https://code.sololearn.com/c8q54ZtWLMp5/?ref=app
25th Jun 2022, 8:43 AM
Slick
Slick - avatar
0
Slick both inputs are same but why they are stored in different address
25th Jun 2022, 8:47 AM
Pythonist
Pythonist - avatar
0
Slick thank you so much 🤝😊
25th Jun 2022, 8:49 AM
Pythonist
Pythonist - avatar
- 1
It doesn’t work
26th Jun 2022, 11:33 PM
Joseph Venturi
Joseph Venturi - avatar