TypeError: Strings must be encoded before hashing

Solution 1:

hashlib.sha224() takes bytes but word is a string. You'll want to convert the string to the utf-8 encoded bytes with word.encode(encoding = 'UTF-8', errors = 'strict')