返回顶部

收藏

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 )

标签:Python,Data,Type

收藏

0人收藏

支持

0

反对

0

»更多 您可能感兴趣的代码
  1. 2016-08-19 12:27:56Complex Number Multiply: the Complex part by 司马
  2. 2016-09-04 09:12:19bitwise AND by 阮小七
  3. 2016-11-21 12:58:55Define and use int by 张宋付
  4. 2016-04-23 15:06:20Code for Handling Large maxints by 山药
  5. 2016-08-19 12:35:54Decimal Floating Point Arithmetic by 山药
  6. 2016-04-23 15:24:16Use ( ) in calculation by 大猪
  7. 2016-08-19 12:56:31Convert String to integer (int) by 阿明娃儿
  8. 2016-11-30 16:19:47Operators with mixed type operands convert the integer operand to floating point: by 西国の海妖
  9. 2016-02-04 16:00:24What's True in Python by 司马
  10. 2016-08-19 13:11:54int function by 西国の海妖
  11. 2016-08-19 13:17:28Long Integer by wubai

发表评论