# grades1.py
# Written by Todd Wareham for CS 2500
"""
Given the name of a single-column text file as a command-line argument where
 each line of the file contains a single course mark, computes and prints 
 the number of letter-grade marks of each type (A, B, C, D, F).

Note that no error-checking is done to ensure that marks are in the range
 0-100.
"""

import sys

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

numA = numB = numC = numD = numF = 0

for grade in open(sys.argv[1]):
    grade = int(grade)
    if (grade >= 80):
        numA += 1
    elif ((grade >= 65) and (grade < 80)):
        numB += 1
    elif ((grade >= 55) and (grade < 65)):
        numC += 1
    elif ((grade >= 50) and (grade < 55)):
        numD += 1
    else:
        numF += 1

print "Grades: ", numA, "As /", numB, "Bs / ", numC, "Cs / ", \
      numD, "Ds / ", numF, "Fs / "
