'is' vs '==' in Python | Python Tutorial - Day #54

preview_player
Показать описание

python, C, C++, Java, JavaScript and Other Cheetsheets [++]:

►Learn in One Video[++]:

►Complete course [playlist]:

Follow Me On Social Media
Comment "#HarryBhai" if you read this 😉😉
Рекомендации по теме
Комментарии
Автор

#COMPARISON OPERATORS

# "is" exact location of a object in memory
# "==" as compared to the object

#values which are immutable returns true in every case

a=4 #int is immutable
b=4

print(a is b)
print(a==b)

a=(1, 2, 5) #tuple is immutable
b=(1, 2, 5)

print(a is b)
print(a==b)

a={1, 2, 5} #lists are un-immutable
b={1, 2, 5}

print(a is b)
print(a==b)

Junaidkhaannn
Автор

One of my friend switched from Java to Python, Interviewer asked him, difference between THIS (Java) and IS (Python) Guys its really a very good content. Thanks a lot to our Respected Harry Bhai.

Wisdomizer
Автор

Thank you for repeating the fork repel option, was having a lot of problems copying the tutorial.

sagnikghosh
Автор

Bro course and videos are amazing ⭐⭐⭐⭐⭐
so simple and easy to understand, you are doing a great job brother,
watching this before going for an interview hope for the best

LaughDoo
Автор

Check memory location of any variable by using print(id(variablename)) by which you can properly understand( is vs ' ==' )

mohammadhasnat
Автор

You are appreciated 👍 For bringing such courses for students.

neelamnishad
Автор

Amazing course with free of cost ♥ .My rating of this course is 5/5 ⭐⭐⭐⭐⭐.

gudducreation
Автор

Day #54 in 100DaysOfCode. Thanks, harry bhai for this awsm course.

thatcoolkid
Автор

#Summary:
Both "is" and "==" are comparison operators in Python.
However, "is" compares the memory location whereas
"==" compare the values.

sakalagamingyt
Автор

Harry's tutorial is easy to understand and remember because it covers one concept at a time.Keep making such videos.

bhakti
Автор

harry bhai maine apki purani playlist ko 3 bar dekha hai, or ise dekh kr mast revision ho raha hai

MrVaibhavv
Автор

thanku so much bhaiya apne free me python ka tutorial YouTube par upload kiya hai. Maine apka channel kal hi dekha aur mujhe apke sikhane ke tarike bahut achha hai

arnktech_
Автор

If we evaluate the below code
a = (1, 2)
b = (1, 2)
print(a is b)

The answer is True in some IDE's like PyCham.
The answer is False in CMD, Mac Terminal or Jupyter.
same id for complex number and float numbers. This is because Python my default allocate two same tuples, complex numbers and float numbers to different memory location but IDE's like like PyCharm, they might have specific optimisations or configurations which allocate in same memory location.

@CodeWithHarry

Azeem_Nadeem
Автор

1:06 - Sir *is* identity operator and *==* is comparison operator

arpankarmakar
Автор

Bhai hum apki yh Wali playlist dekhe ya jo 11hrs Wali video ha old one. Which one is good?

muhammadammariqbal
Автор

Harry bhai 2nd video ma jo programs ha unki repl fork ku nahi ho rahi

azibali
Автор

harry aap ney apne YT channel k about session may email view k liye recaptcha button lagaya hoa hai kese lagaya please tutorial complete

ranarare
Автор

Conclusion of video :-
'==' match that Is both variables are identical
'is' match that does both variables are exactly same

sumitnain
Автор

watching Day 54 on 1/1/2024 :)
Really helpful course. Thanks Sir Harry

quality.random
Автор

This day is technical theoretic to understand !

KarachiKaBanda
join shbcf.ru