Computer Science

What will following code print?

a = 3
b = 3.0
print (a == b)
print (a is b)

Python

Python Data Handling

20 Likes

Answer

This Python code prints:

True
False

As values of a and b are equal so equality operator returns True. a is of int type and b is of float type so a and b are different objects so a is b returns False.

Answered By

10 Likes


Related Questions