Hello, I’m currently doing this quiz:
There’s a piece of code that looks like this;
def print_some_characters(word): for i in range(len(word)): if i % 2 == 0: print(word[i]) print_some_characters("watermelon")
My first question is why does it use range(len()) instead just for i in word?
My other, bigger question is how is it possible to use modulo on a string. i in this code corresponds to a singular character from a string that is being iterated through, so how come modulo operator is able to do a mathematical calculation on a string?