summaryrefslogtreecommitdiff
path: root/worth-it
diff options
context:
space:
mode:
authorAnton Bobov <abobov@gmail.com>2020-02-27 21:50:14 +0500
committerAnton Bobov <abobov@gmail.com>2020-02-27 21:50:14 +0500
commit36e6977442bab1724135ab60b171d59b38bb7111 (patch)
treefa465b79483b900e56e8b63c6ea9ee59d07a3fdb /worth-it
parentd34161bbda6781a617705ee429776e53768c7b51 (diff)
Update to python3
Diffstat (limited to 'worth-it')
-rwxr-xr-xworth-it18
1 files changed, 9 insertions, 9 deletions
diff --git a/worth-it b/worth-it
index 64b8f29..35fd276 100755
--- a/worth-it
+++ b/worth-it
@@ -1,16 +1,16 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def read_data():
data = []
while True:
- text = raw_input()
+ text = input()
if text == '':
break
try:
sp = text.split()
- (value, cost) = map(float, sp)
+ (value, cost) = list(map(float, sp))
data.append((cost / value, value, cost, text))
except ValueError:
pass
@@ -18,16 +18,16 @@ def read_data():
def main():
- print 'Enter data table (last line should be empty): value cost'
- print
+ print('Enter data table (last line should be empty): value cost')
+ print()
data = sorted(read_data())
if len(data):
- print '%10s | %10s | %10s' % ("Ratio", "Value", "Cost")
+ print('%10s | %10s | %10s' % ("Ratio", "Value", "Cost"))
for ratio, _, _, orig_value in data:
- print '%10.2f | %10s | %10s' % tuple([ratio, ] + orig_value.split())
- print
- print 'Best choose is %s' % data[0][-1]
+ print('%10.2f | %10s | %10s' % tuple([ratio, ] + orig_value.split()))
+ print()
+ print('Best choose is %s' % data[0][-1])
if __name__ == '__main__':