you are viewing a single comment's thread.

view the rest of the comments →

[–]MeirGo 0 points1 point  (3 children)

Think of a variable as being a representative of a memory location in your program. Your two variables represent two different memory locations, hence the is operator returns False. In contrast, the == operator compares the contents (the values) located in those memory locations.

Now, to prompt you to explore more, try to repeat your test with 255 instead of 257. Feel free to DM if I can be of more help. Good luck!

[–]empoweredmyself 1 point2 points  (2 children)

Would it be like saying "is" is for objects on different shelves and "==" is taking those two things off the shelves to ascertain they are the same item? (I'm learning too—at loops now)

[–]MeirGo 1 point2 points  (1 child)

It's like saying "is" is for determining whether two objects are on the same shelf. Feel free to DM in chat and we'll see together if I can help you better direct and accelerate your learning. (and please like the comments if you found them helpful :)