 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Explain difference between == and is operator in Python.
== operator
== operator compares the operands by checking the equality of values of objects.
is operator
is operator compares the operands by checking the objects to be the same or not.
Example
Following is the program in Python to showcase the difference.
list1 = [1] list2 = [1] list3 = list1 print(id(list1)) print(id(list2)) if (list1 == list2):    print("True") else:    print("False") if (list1 is list2):    print("True") else:    print("False") if (list1 is list3):    print("True") else:    print("False")  Output
140380664377096 140380664376904 True False True
Advertisements
 