What value is given to this space " " when indexing strings | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What value is given to this space " " when indexing strings

Question

8th Dec 2020, 12:23 PM
David Lahu
David Lahu - avatar
3 Answers
+ 7
David Lahu , as the string consists of only one character (space), the index is 0. Indexing always starts with 0 in python and in most other languages.
8th Dec 2020, 12:35 PM
Lothar
Lothar - avatar
+ 2
Well, a space is " " as character. But maybe I get your question wrong?
8th Dec 2020, 12:38 PM
Lisa
Lisa - avatar
0
Lisa you're right but I got it now thanks anyway
8th Dec 2020, 12:52 PM
David Lahu
David Lahu - avatar