RosettaCodeData/Task/Integer-comparison/Python/integer-comparison-2.py

16 lines
338 B
Python
Raw Permalink Normal View History

2013-04-10 21:29:02 -07:00
#!/usr/bin/env python
import sys
try:
2015-11-18 06:14:39 +00:00
a = input('Enter value of a: ')
b = input('Enter value of b: ')
2013-04-10 21:29:02 -07:00
except (ValueError, EnvironmentError), err:
print sys.stderr, "Erroneous input:", err
sys.exit(1)
dispatch = {
-1: 'is less than',
0: 'is equal to',
1: 'is greater than'
}
print a, dispatch[cmp(a,b)], b