# Compare integers using if structures, relational operators and equality operators. : Int « Data Type « Python

Home
Python
 1 2D 2 Application 3 Buildin Function 4 Class 5 Data Structure 6 Data Type 7 Database 8 Development 9 Dictionary 10 Event 11 Exception 12 File 13 Function 14 GUI Pmw 15 GUI Tk 16 Language Basics 17 List 18 Math 19 Network 20 String 21 System 22 Thread 23 Tuple 24 Utility 25 XML
 Python » Data Type » Int Screenshots
Compare integers using if structures, relational operators and equality operators.
 ```  # read string and convert to integer number1 = raw_input( "Please enter first integer: " ) number1 = int( number1 ) number2 = raw_input( "Please enter second integer: " ) number2 = int( number2 ) if number1 == number2:    print "%d is equal to %d" % ( number1, number2 ) if number1 != number2:    print "%d is not equal to %d" % ( number1, number2 ) if number1 < number2:    print "%d is less than %d" % ( number1, number2 ) if number1 > number2:    print "%d is greater than %d" % ( number1, number2 ) if number1 <= number2:    print "%d is less than or equal to %d" % ( number1, number2 ) if number1 >= number2:    print "%d is greater than or equal to %d" % ( number1, number2 )                         ```
Related examples in the same category
 1 Define and use int 2 Int: modulus (remainder), power 3 A value as a condition 4 Define and use integer 5 Int value demo 6 Convert String to integer (int) 7 Using Python as a Calculator 8 oct and hex function 9 int function 10 convert integers to octal and hexadecimal strings with a string formatting expression: