Hi everyone. I hope everyone is doing well. Thanks @neodynamics and @fisiha1224 for answering my question. I'm back with another question today. When I typed in "print(1 is 1)" to the python shell, it returned "True". But it also diplayed above it, "<stdin>:1: SyntaxWarning: "is" with 'int' literal. Did you mean "=="?" I'm curious why it displayed this message. Thanks
5 июля 2024
👨🏾💻Hi everyone. I hope everyone is doing well. Thanks @neodynamics and @fisiha1224 for answering my question. I'm back with another question today. When I typed in "print(1 is 1)" to the python shell, it returned "True". But it also diplayed above it, "<stdin>:1: SyntaxWarning: "is" with 'int' literal.
The "is" keyword is used to compare if two objects are the same. The interpreter is just warning you because there's no need to compare integers by their objects, since 1 will always be 1 irrespective of where it is used and no two different integers can be the same object.
So it's just asking you if you wanted to use the equality sign since that's what you should normally use to compare integers
Benjamin FarunaThe "is" keyword is used to compare if two objects are the same. The interpreter is just warning you because there's no need to compare integers by their objects, since 1 will always be 1 irrespective of where it is used and no two different integers can be the same object.
So it's just asking you
You can try using the "id" keyword to check the object id of those integers and compare it to how it works on lists and sets.
Two lists can contain the same elements and they're different objects, but that's not the case with immutable data types
Benjamin FarunaThe "is" keyword is used to compare if two objects are the same. The interpreter is just warning you because there's no need to compare integers by their objects, since 1 will always be 1 irrespective of where it is used and no two different integers can be the same object.
So it's just asking you
Got it. Thank you!
ArchangelHello, My name is Michael, I'm from Sierra Leone. I'm new here and I'm an absolute beginner.
I'm also like you bro, don't be discouraged and let's dive together. Mostly everyone here are beginners.
Welcome!
I'm from Ethiopia 🇪🇹
Hey, how are u? @asabeneh I'm from Brazil and I would like to create a session so I can translate the repository into Portuguese, because here in Brazil there are a lot of people who don't know English and I think your repository would have a greater reach and help more people on their journey of learning English. python, I am available to do the translation, I am an enthusiast of your idea of the 30 day python challenge. I will do part of the translation per day so as not to overwhelm myself and add the translated readmes gradually, I will follow the original folder structure that you created but translated and in the directory that I will call Portuguese.