String encode

In one of the exercises, we make a hash function by using the string method encode. We then use sum to add up the values I am guessing. But I am confused about how we can use sum, since the encoding does not return only numbers, and neither an array.

For example

The string is: pythön!
The encoded version (with ignore) is: b’pythn!’
The encoded version (with replace) is: b’pyth?n!’

Thanks,

Andrej

Could you provide a link to the exercise?

https://www.codecademy.com/paths/computer-science/tracks/complex-data-structures/modules/cspath-hash-maps/lessons/hash-maps-implementation/exercises/defining-the-setter

why is b’hey’ iterable… we can use sum on it?

also why when you say b’hey’[0] you get 104 and not h?

How can I convert b’hey’ into the numbers that print out when you call them by index?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.