0
str="HELLO" find the output if print(str[::4]) ?
Pls anyone answer this question with explanation?
3 Answers
+ 4
It's about slicing. What can't you understand?
Start, end values for slicing are not specified so defaults are 0, len(str) and 4 is step count. So starts from index 0 , value at index 0 and 0+4 value will be printed
output is : HO
Next 4+4 is out of range.
Hope it clears...
+ 2
Thank you so much Jayakrishnaš®š³ I was a bit confused regarding the answer now everything is clear ... Thank you for your great help buddy
0
You're welcome...