Why didn't I get the expected value printed out?


#1

Question

In the context of this exercise, why didn’t I get the expected value printed out?

Answer

There are some possible reasons.

One is that the wrong key was used. Make sure it is “gneiss”, a string value. Anything else can result in a different value printed out.

If you entered the right word, the reason can be casing, because lowercase and uppercase characters have different encoding values.

print(sum(("Gneiss").encode())) # 617
print(sum(("gneiss").encode())) # 649