Identity Operators


This code prompts the user to input two numbers (number_1 and number_2) and stores them as integers. It then checks if number_1 is equal to number_2 using the 'is' operator, which checks if the two variables refer to the same object in memory. If the two variables are equal, it prints "The two values are same." If they are not equal, it prints "The two values are not same."

Source Code : 1

number_1 	=int(input("Enter Number 1 : "))
number_2 	=int(input("Enter Number 2 : "))

if number_1 is number_2 :
    print("The two value are same")
else:
    print("The two value are not same ");
To download raw file Click Here

Output : 1

Enter Number 1 : 8
Enter Number 2 : 9
The two value are same

This code prompts the user to input two numbers (number_1 and number_2) and stores them as integers. It then checks if number_1 is not equal to number_2 using the 'is not' operator, which checks if the two variables do not refer to the same object in memory. If the two variables are not equal, it prints "The two values are not same." If they are equal, it prints "The two values are same."

Source Code : 2

number_1 	=int(input("Enter Number 1 : "))
number_2 	=int(input("Enter Number 2 : "))

if number_1 is not number_2 :
    print("The two value are not same")
else:
    print("The two value are  same ");
To download raw file Click Here

Output : 2

Enter Number 1 : 8
Enter Number 2 : 9
The two value are not same