Python Exercise Example 48
**Problem:** 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:
(
'%d is greater than %d'
%
(
i
,
j
)
)
elif
i
==
j:
(
'%d is equal to %d'
%
(
i
,
j
)
)
elif
i
<
j:
(
'%d is less than %d'
%
(
i
,
j
)
)
else
:
(
'Unknown'
)
The output of the above example is:
10 小于 20
Python 100 Examples