Wednesday, November 20, 2019

comparing the list elements in python


comparing list elements.

x=['abc','bcd','cde']
y=['abc','bcd','cde']
z=['ABC','BCD','CDE']
print(x==y)
print(x==z)
print(x!=z)

output:
True
False
True

example 2:
x=['abc','bcd','cde']
y=['abc','bcd','cde']
z=['ABC','BCD','CDE']
print(x[0] is y[0])
print(x==z)
print(x!=z)

output:
True
False
True

No comments:

Post a Comment

python class topic video