You're diffing msg_frqs
with FREQUENCIES
. The latter's sum is 1, the former's isn't, because you're counting the upper case letters in msg_length
but not in msg_frqs
. That seems inappropriate. So better start getGoodness
with msg = msg.lower()
.
And I wouldn't round
. Why throw away information? Especially using extra code and time.