0
Does spaceââ has index?
str = "Hello world!" print(str[6]) If space has index, It should be printing space instead of w. Why does this happen?
1 Answer
+ 6
Points to remember :
âșïžEvery character in python has index it doesn't matter it's inside string or list.
âșïžindexing starts from 0
https://www.sololearn.com/learning/2431/
-------------------------------------------------
str="Hello world!"
H=0
e=1
l=2
l=3
o=4
" " = 5 #space
w=6
that's why str[6] printing 'w'.