Skip to content

Commit 6d38d97

Browse files
committed
Update multlists.py
1 parent 231773a commit 6d38d97

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

multlists.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1+
"""
2+
(c) Sergio Morales
3+
CodeEval Challenge: Multiply Lists
4+
Date Solved: 12/20/13
5+
"""
6+
7+
#!/usr/local/bin/python3
8+
19
import sys
10+
211
test_cases = open(sys.argv[1], 'r')
312
for test in test_cases:
4-
list1 = test[0:test.find("|")-1]
5-
list2 = test[test.find("|")+1:]
13+
list1 = test[0:test.find("|")-1].split(" ")
14+
list2 = test[test.find("|")+2:len(test)-1].split(" ")
15+
616
list1 = [int(x) for x in list1]
717
list2 = [int(x1) for x1 in list2]
818

9-
for i in range(0,len(list1)-1):
10-
print(list1[i]*list2[i]+" ", end="")
19+
for i in range(0,len(list1)):
20+
print(str(list1[i]*list2[i])+" ", end="")
1121
print("", end="\n")
1222
test_cases.close()

0 commit comments

Comments
 (0)