Python Practice Example 48

Python 100例Python 100 Examples

Title:Number comparison.

Program analysis:None

Program source code:

Example

#!/usr/bin/python
# -*- coding: UTF-8 -*-
 
if __name__ == '__main__':
    i = 10
    j = 20
    if i > j:
        print ('%d is greater than %d' % (i,j))
    elif i == j:
        print ('%d equals %d' % (i,j))
    elif i < j:
        print ('%d is less than %d' % (i,j))
    else:
        print ('Unknown')

The output result of the above example is:

10 小于 20

Python 100例Python 100 Examples

Other extensions