Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
10
Task/Integer-comparison/Python/integer-comparison-1.py
Normal file
10
Task/Integer-comparison/Python/integer-comparison-1.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
a = input('Enter value of a: ')
|
||||
b = input('Enter value of b: ')
|
||||
|
||||
if a < b:
|
||||
print 'a is less than b'
|
||||
elif a > b:
|
||||
print 'a is greater than b'
|
||||
elif a == b:
|
||||
print 'a is equal to b'
|
||||
15
Task/Integer-comparison/Python/integer-comparison-2.py
Normal file
15
Task/Integer-comparison/Python/integer-comparison-2.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
import sys
|
||||
try:
|
||||
a = input('Enter value of a: ')
|
||||
b = input('Enter value of b: ')
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue