Pyglatin 10/11. Why 4?


#1

I learned that in Python, I should match the alphabet with the number starting from ZERO.
But “Charlie”[1:4] is not “harl” but “har”. I don’t understand why this happens :frowning:

What’s wrong? Help my!


#2

this:

"Charlie"[1:4]

is string slicing, the general syntax is:

"string"[start:stop]

but its values lesser then (<) the stop value, not lesser then or equal to.


#3

Ohhh god I got it on later lesson XD… Thanks a lot to your kindness :slight_smile:


#4

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