great video! so the + 1 in len(sentence) + 1, is there because of the index being 0?
@wrttech4222 жыл бұрын
The range function is noninclusive meaning if you write: for i in range(1,10), i will be 1,2,3...9. We write len(sentence) + 1 so that the for loop will include every position from 1 to n that exists in our sentence. If we wrote for i in range(1, len(sentence)) and the length of sentence was 5, i would be 1,2,3,4 which would exclude the last position in our sentence which would be position #5.
@Squinkle2 жыл бұрын
@@wrttech422 Great explanation thank you very much!!!