# sumfile3.py
# Written by Todd Wareham for CS 2500
"""
Given the name of a file of integers as a command-line argument, computes and
 prints the number and total of positive non-zero integers in this file.

This version is implemented using list-comprehensions.
"""

import sys

if len(sys.argv) != 2:
    print "usage: ", sys.argv[0], " filename"
    sys.exit(1)

f = open(sys.argv[1])
line = f.read()
f.close()

sum = sum([int(x) for x in line.split() if x > 0])
numPInt = len([int(x) for x in line.split() if x > 0])

print "sum, # +ve int = ", sum, ",", numPInt

