def calculateMG(plain):
    counts = [];
    for i in range(256):
        counts.append(0);
    
    for i in range(len(plain)):
        if (128 < plain[i]):
            counts[ord(chr(plain[i]).upper())] += 1;    
    
    result = 0.0;
    for i in string.ascii_uppercase:
        result += letterFrequency[i]*counts[ord(i)];
    result += letterFrequency[' '] * counts[ord(' ')];
    result /= len(plain);
    return result;
dataset/ETHPy150Open reschly/cryptopals/prob3.py/calculateMG/swapped operands of `<`