# Use the hash function to find places for soldiers.
totalCells = 135
# This function hashes a string value to an integer.
def hashName(name):
hash = 0
for letter in name:
hash += ord(letter)
# The hash value should be from 0 to 134.
# Use modulus operation to "cut" the hash value.
hash = hash.mod(135)
return hash
soldiers = hero.findByType("soldier")
# For each soldier say his/her name (id) and hash of it.
# The name and the number should be splitted by whitespace.
for soldier in soldiers:
hashedName = hashName(soldier.id)
hero.say(soldier.id + hashedName)

The error is:
Fix Your Code
Line 8: TypeError: need an object
The weird thing is that when I debug with hero.say(name) in the hashName Function it says the name of the soldier correctly.

My apologies if this is supposed to be obvious, but I don’t understand what I’m supposed to do when you say (line 11):

# Use modulus operation to "cut" the hash value.

I understand that there are only 135 total cells, but how am I supposed to know how high the sums from the hash function are, in order to modulus them into something in between 1 and 135? I can hack it, but I understand that there’s something that’s supposed to be intuitive that I missed here.