Answer to Question #337443 in Python for Xix

Question #337443

Create a Python code that will accept two numbers from the user and prints "True" if it satisfies the condition and "False" otherwise. Use comparison operators ">", "<=", "!=", ">=", and "<".

1
Expert's answer
2022-05-05T09:33:48-0400
# if number only integers use int, if number integer and float use - float
num1 = int(input('Input first number:'))
num2 = int(input('Input second number:'))


print('True' if num1 > num2 else 'False')
print('True' if num1 <= num2 else 'False')
print('True' if num1 != num2 else 'False')
print('True' if num1 >= num2 else 'False')
print('True' if num1 < num2 else 'False')

OUTPUT:

Input first number:25

Input second number:36

False

True

True

False

True


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS