Python Series- is Vs == Indepth Explanation- Boolean Evaluation
Skills:
Python for Data90%
Key Takeaways
Explains Python's IS vs == operators in depth
Full Transcript
hello all my name is krishnan welcome to my youtube channel so guys today in this particular video we are going to see the difference between is keyword and double equal to so here we are basically going to see two things one is is versus double equal to now remember there's a lot of confusion with uh people also and yesterday also i was taking one of the session where people had a lot of doubts with respect to ease and double equal to so let's try to understand this and let's try to take some of the examples so first of all i am going to make a list where i have elements like probably crash uh i have three names suppose so i say krish and then i say crush one right if i say krish to so i have these all elements right and similarly what i do this is my list one okay and then i'm just going to copy this entirely and then i'm going to basically paste it over here now when i have this and let me just rename this into list2 now in this video now what i will be doing is that now see this if i use list one double equal to list two right this is a simple code over here where i'm just writing list one is equal to list two this is nothing but double equal to basically means that we are going to compare whether these two lists are equal or not just understand this equal with the with respect to the elements that are present inside this if i try to execute this definitely it will be coming as true okay so here i'm actually checking whether list one and list two are equal or not and obviously just by seeing it all the elements inside this list are different if i try to change this into something else and if i try to again execute it it is basically giving me false so let me make it back okay now this is with respect to double equal to operation that basically means whatever things i'm actually trying to compare you know like if i'm if i made a string like crash and probably my b string is again crash okay that basically means that if i try to compare any of this kind of variables which is having probably the same value inside it but remember all this will be having a different different memory location so when i'm doing this kind of comparison a double equal to b i'll definitely be getting as true before going ahead with respect to this particular video this video has been sponsored by an academy so guys if you are in the final year of a graduation or planning to prepare for gate or eac examination then you are at the right place an academy is back with its cs or it batch evolve 2022 these batches are starting from 18 jan 2021 don't miss a single class take all the live session and prepare with the best unacademy educators including ravindra babu rahula if you don't know about ravindra babu ravula guys he's an amazing teacher and you can also see his youtube videos with respect to gate you will be getting 800 plus hours of total lectures covering the full gate or esc course along with solving all your doubts do make sure that you try to use my code that is kn06 to get an additional 10 percent discount you can also take the demo class to get a full clarity about the educator that is ravindra babu ravula and subscribe to this particular platform all the information regarding this will be given in the description of this particular video now coming to the is keyword okay so let's see if i try to use the same list1 and list2 and i'll try to use the is keyword so if i use list 1 is list 2 if i try to execute over here you can see that i'm getting false now why probably i'm getting a false will try to understand but before that let me take one more example over here okay now instead of just writing like this i'll just copy this and now i will just paste it over here and let me do one thing instead of assigning this particular value again remember whenever we are assigning some values over here this will be taking a different memory location it will get saved over here this will be stored in different memory location now instead of doing this i'll remove this and i'll assign it to list one now when i am doing this now just see what will be the output over here list1 is list2 so when i execute this this will be true okay i'll tell you why it is true let me just reverse this thing again instead of making list 1 let me write it at list2 is list1 okay now here also you can see this is true now remember one thing guys whenever we are using the east keyword okay is keyword is just not about comparison of the elements instead it will try to see first of all in list one we have saved some kind of elements over here you can see some of the elements items are there and this items probably may be like allocated in a different memory location in some memory location and that same reference is basically provided to the list too when we do like this and at that time when we try to compare with respect to the east keyword then it basically gives me a true value again understand guys here different objects are not getting created only one object has been created in the memory and that is being referred by both the variables that is the most important thing to understand with respect to double equal to this does not happen like that in double equal to you'll be having two different memory location and you'll try to compare whatever values basically stored within them and then it will try to say whether it is true or false and this is very very important because probably in the next video i'll be also uploading about numpy dot array versus numpy dot azure so tell me the difference between this anyhow i'll be trying to create a video in my next next uh video in python series but just understand what is the basic difference between np dot array versus np dot as array let me talk one more concept which is called as mutability now guys remember if i make this changes like this and if i assign list one to list two now suppose my list two of zero is basically krish if i try to change it to something like krish two suppose okay now if i go and see my list two and here you'll be able to see krishna krishna and krishna okay but what about list one well whether the list one will also get updated then we can definitely see over here the list one is also getting updated with respect to the elements so wherever mutability is possible see in this particular case something is stored in one memory location two variables are referring that if one variable a child should change that particular value it will also get reflected to the other things so that is the reason why we use shallow copy and deep copy i'll also be creating a video on shallow copy and deep copy and we'll try to see how we can prevent that in order to just prevent it what we have to do is that when we are assigning like this we just have to use dot copy operation to make it as a deep copy deep copy basically means it will create a different memory location even for list2 so i hope you understood this particular video this is the basic difference between is versus double equal to uh now you probably you may have understood when should we use double equal to and when we have to use is when does it give true or when does it get false right this is just like a boolean operation so this is all about this particular video guys i'll see you all in the next video have a great day thank you and all bye
Original Description
github: https://github.com/krishnaik06/Machine-Learning-in-90-days/blob/master/Section%201-%20Python%20Crash%20Course/Python%20IS%20Keyword.ipynb
Evolve for GATE 2022 | CS/IT: https://bit.ly/3svw5Cm
Demo Class:
CS/IT: https://unacademy.com/class/last-30-days-preparation-strategy-for-gate-2021-csit/R5NOYSA0
Use Code: KN06
⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. I've been using Kite for a few months and I love it! https://www.kite.com/get-kite/?utm_medium=referral&utm_source=youtube&utm_campaign=krishnaik&utm_content=description-only
All Playlist In My channel
Interview Playlist: https://www.youtube.com/playlist?list=PLZoTAELRMXVM0zN0cgJrfT6TK2ypCpQdY
Complete DL Playlist: https://www.youtube.com/watch?v=9jA0KjS7V_c&list=PLZoTAELRMXVPGU70ZGsckrMdr0FteeRUi
Julia Playlist: https://www.youtube.com/watch?v=Bxp1YFA6M4s&list=PLZoTAELRMXVPJwtjTo2Y6LkuuYK0FT4Q-
Complete ML Playlist :https://www.youtube.com/playlist?list=PLZoTAELRMXVPBTrWtJkn3wWQxZkmTXGwe
Complete NLP Playlist:https://www.youtube.com/playlist?list=PLZoTAELRMXVMdJ5sqbCK2LiM0HhQVWNzm
Docker End To End Implementation: https://www.youtube.com/playlist?list=PLZoTAELRMXVNKtpy0U_Mx9N26w8n0hIbs
Live stream Playlist: https://www.youtube.com/playlist?list=PLZoTAELRMXVNxYFq_9MuiUdn2YnlFqmMK
Machine Learning Pipelines: https://www.youtube.com/playlist?list=PLZoTAELRMXVNKtpy0U_Mx9N26w8n0hIbs
Pytorch Playlist: https://www.youtube.com/playlist?list=PLZoTAELRMXVNxYFq_9MuiUdn2YnlFqmMK
Feature Engineering :https://www.youtube.com/playlist?list=PLZoTAELRMXVPwYGE2PXD3x0bfKnR0cJjN
Live Projects :https://www.youtube.com/playlist?list=PLZoTAELRMXVOFnfSwkB_uyr4FT-327noK
Kaggle competition :https://www.youtube.com/playlist?list=PLZoTAELRMXVPiKOxbwaniXjHJ02bdkLWy
Mongodb with Python :https://www.youtube.com/playlist?list=PLZoTAELRMXVN_8zzsevm1bm6G-
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Krish Naik · Krish Naik · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Natural Language Processing|Stemming
Krish Naik
Natural Language Processing|BagofWords
Krish Naik
Gaussian distribution or Normal Distribution in statisctics
Krish Naik
Natural Language Processing|TF-IDF for Machine Learning| Text Prerocessing
Krish Naik
Log Normal Distribution in Statistics
Krish Naik
Covariance in Statistics
Krish Naik
Confusion matrix, Precision, Recall| Data Science Interview questions
Krish Naik
Tutorial 44-Balanced vs Imbalanced Dataset and how to handle Imbalanced Dataset
Krish Naik
Implementing a Spam classifier in python| Natural Language Processing
Krish Naik
Tutorial 11-Exploratory Data Analysis(EDA) of Titanic dataset
Krish Naik
Face Recognition using open CV and VGG 16 Transfer Learning
Krish Naik
Pedestrian Detection using OpenCV from Videos
Krish Naik
Face and Eye Detection from Videos using HAAR Cascade Classifier
Krish Naik
Reading, Writing and Displaying images with Opencv| OpenCV Tutorial
Krish Naik
OpenCV Installation | OpenCV tutorial
Krish Naik
Face and Eye Detection from Images using HAAR Cascade Classifier
Krish Naik
Car Detection using HAAR Cascade and Opencv from Videos.
Krish Naik
Using OpenFace for Face recognition in Keras
Krish Naik
OpenPose Tutorial with Tensorflow
Krish Naik
Multiple Linear Regression using python and sklearn
Krish Naik
Dimensional Reduction| Principal Component Analysis
Krish Naik
Movie Recommender System using Python
Krish Naik
TPR,FPR,FNR,TNR, Confusion Matrix
Krish Naik
Precision, Recall and F1-Score
Krish Naik
Artificial Neural Network for Customer's Exit Prediction from Bank
Krish Naik
GridSearchCV- Select the best hyperparameter for any Classification Model
Krish Naik
RandomizedSearchCV- Select the best hyperparameter for any Classification Model
Krish Naik
K Nearest Neighbor classification with Intuition and practical solution
Krish Naik
K Means Clustering Intuition
Krish Naik
Create custom Alexa Skill- Lambda function- Part2
Krish Naik
Hierarchical Clustering intuition
Krish Naik
Implement Transfer Learning with a generic Code Template
Krish Naik
Gender Classifier and Age Estimator using Resnet Convolution Neural Network
Krish Naik
Unlock Your Application With Your Face using OpenCV
Krish Naik
Draw rectangle from webcam and sketch process it on a live feed
Krish Naik
Complete Life Cycle of a Data Science Project
Krish Naik
How we can apply Machine Learning in Finance
Krish Naik
Deep Learning in Medical Science
Krish Naik
How to switch your career to Data Science.
Krish Naik
Linear Regression Mathematical Intuition
Krish Naik
Handle Categorical features using Python
Krish Naik
Machine Learning Algorithm- Which one to choose for your Problem?
Krish Naik
DBSCAN Clustering Easily Explained with Implementation
Krish Naik
Curse of Dimensionality Easily explained| Machine Learning
Krish Naik
Feature Selection Techniques Easily Explained | Machine Learning
Krish Naik
Tutorial 29-R square and Adjusted R square Clearly Explained| Machine Learning
Krish Naik
Cross Validation using sklearn and python | Machine Learning
Krish Naik
Handling Missing Data Easily Explained| Machine Learning
Krish Naik
Deploy Machine Learning Model using Flask
Krish Naik
Deployment of Deep Learning Model using Flask
Krish Naik
How to Visualize Multiple Linear Regression in python
Krish Naik
K Nearest Neighbour Easily Explained with Implementation
Krish Naik
Predicting Heart Disease using Machine Learning
Krish Naik
Predicting Lungs Disease using Deep Learning
Krish Naik
Stock Sentiment Analysis using News Headlines
Krish Naik
Random Forest(Bootstrap Aggregation) Easily Explained
Krish Naik
Voting Classifier(Hard Voting and Soft Voting Classifier)
Krish Naik
Credit Card Fraud Detection using Machine Learning from Kaggle
Krish Naik
Hyperparameter Optimization for Xgboost
Krish Naik
Tutorial 45-Handling imbalanced Dataset using python- Part 1
Krish Naik
More on: Python for Data
View skill →Related Reads
📰
📰
📰
📰
Why I’m Thinking of Switching My Portfolio to Astro.js ..
Dev.to · Kavin HBN
Angular : do we need CSP_NONCE for both Frontend & Backend toghether ?
Medium · Programming
You Have a System Design Interview in a Week and You Know You’re Not Ready.
Medium · DevOps
I Built a Free PDF Tool That Runs 100% in Your Browser (No Uploads, No Servers)
Dev.to · pirate_haizei
🎓
Tutor Explanation
DeepCamp AI