Operators in python

jb mene
x = [“apple”,“mango”]

y = [“apple”,“mango”]
print(y is x)
to false print hua
lekin jb mene
x = 5

y = 5
print(x is y)
to true print hua
why is this happening???

please help me…

Dear learner,

Welcome to Learnvern! We are happy to serve you.

We hope our following reply serves your query well.

In your code you have assigned both the variables x and y with value 5, while before this y was having the value - apple, mango and x was 5. Here instead of printing, it seems your code is checking the value of x and y, as both x and y have the value 5, it is showing the result as true.

If you want to print x is y you have to include single quotes as shown below:
print(‘x is y’)

Keep learning.
Does this answer your questions? Please give your feedback to our response.

Thanks and regards,
Team Learnvern.