Skip to content

Commit

Permalink
Add kattis prob pervasiveheartmonitor in python3
Browse files Browse the repository at this point in the history
  • Loading branch information
iandioch committed Mar 13, 2017
1 parent c471a5b commit 7e98d04
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions kattis/pervasiveheartmonitor/solution.py
@@ -0,0 +1,15 @@
import sys

digs = set(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'])

for line in sys.stdin.readlines():
name = []
tot = 0
n = 0
for word in line.split():
if word[0] in digs:
tot += float(word)
n += 1
else:
name.append(word)
print('{:.4f}'.format(tot/n), ' '.join(name))

0 comments on commit 7e98d04

Please sign in to comment.