Important Notice:

Course Content
List Manipulation in Python (Chapter-7) M3-R5
About Lesson
Comparison of list:-

                लिस्ट object को compare करने के लिए comparison operator का use किया जाता है comparison करने के लिए number of Element, order of element और list case sensitive होना चाहिए।

x=[‘Dog’, ‘Cat’, ‘Rat’]

y=[‘dog’, ‘cat’, ‘rat’]

z=[‘DOG’, ‘CAT’, ‘RAT’]

print(x==y)            #False

print(x==z)            # False

print(x!=z)             # True

Note:- जब relational operator (>, <, >=, <=) के बीच list object का comparison करते हैं। तो केवल list object के first Element का comparison perform होता है।

a=[50, 60,70, 80]

b= [40, 60, 70, 80, 90]

print(a>b)                                # True

print(a<b)                                # False

 

Comparison of list:-

                Comparison operator is used to compare list objects. To compare, number of element, order of element and list should be case sensitive.

x=[‘Dog’, ‘Cat’, ‘Rat’]

y=[‘dog’, ‘cat’, ‘rat’]

z=[‘DOG’, ‘CAT’, ‘RAT’]

print(x==y)                        #False

print(x==z)                        # False

print(x!=z)                         # True

Note:- When comparing list objects between relational operators (>, <, >=, <=). So only the comparison of the first element of the list object is performed.

a=[50, 60,70, 80]

b= [40, 60, 70, 80, 90]

print(a>b)                               # True

print(a<b)                               # False

error: Content is protected !!