0% found this document useful (0 votes)
19 views1 page

Comparison Operators

The document demonstrates the use of comparison operators in Python by prompting the user to input two numbers and then comparing them using ==, >, <, >=, <=, and != operators and printing the results.

Uploaded by

RRC
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views1 page

Comparison Operators

The document demonstrates the use of comparison operators in Python by prompting the user to input two numbers and then comparing them using ==, >, <, >=, <=, and != operators and printing the results.

Uploaded by

RRC
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

2/10/2021 ComparisonOperators_Romit_Ranjan_Choudhary

In [1]: """Comparison Operators"""

x = input('Enter a number: ')


y = input('Enter another number: ')
#'=='
print ('Are the numbers equal?', x == y )
#'>'
print ('Is the first number greater than the second number?', x > y )
#'<'
print ('Is the first number lesser than the second number?', x < y )
#'>='
print ('Is the first number greater than or equal to the second number?', x >=
y )
#'<='
print ('Is the first number lesser than or equal to the second number?', x <=
y )
#'!='
print ('Is the first number not equal to the second number?', x != y )
print ('Thank you !')

Enter a number: 34
Enter another number: 69
Are the numbers equal? False
Is the first number greater than the second number? False
Is the first number lesser than the second number? True
Is the first number greater than or equal to the second number? False
Is the first number lesser than or equal to the second number? True
Is the first number not equal to the second number? True
Thank you !

In [ ]:

file:///D:/pieton/operatorz/ComparisonOperators_Romit_Ranjan_Choudhary.html 1/1

You might also like