why did python return answer as 8 instead of 7 cos i'm told we start counting from 0 ,help i'm a noob | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why did python return answer as 8 instead of 7 cos i'm told we start counting from 0 ,help i'm a noob

phrase="Giraffe Academy" print(phrase.index("A"))

14th Feb 2020, 1:29 PM
Alex Trice
Alex Trice - avatar
2 Answers
+ 3
0 G 1 i 2 r 3 a 4 f 5 f 6 e 7 " " (space) 8 A
14th Feb 2020, 1:34 PM
Gordon
Gordon - avatar
+ 3
okay we count space as well?? thanks a mil!!!
14th Feb 2020, 1:35 PM
Alex Trice
Alex Trice - avatar